$array = array('a', 'b','c'); unset($array[0]); var_dump($array); Yields: array(1) { [1]=> 'b' 'c' }
How can I remove array [0] to get ['bb', 'cc'] (without empty keys):
array(1) { 'b' 'c' }
Check this:
$array = array('a', 'b','c'); unset($array[0]); $array = array_values($array); //reindexing
Take a look at array_splice()
array_splice()
$array = array_splice($array, 0, 1);
If you accidentally deleted the first element (and not an arbitrary element in the middle of the array), array_shift() more appropriate.
array_shift()
Source: https://habr.com/ru/post/921093/More articles:Using tor proxies with scrapy - pythonCannot connect ASP.NET database to SQL Server Management Studio - asp.netJava file extension without substring - javaperformance through static variables in fortran - optimizationpython unittests with multiple settings? - pythonmysql selects all records where the datetime field is less than the specified value - phpChange SpringSource Tool Suite - eclipsegit search for duplicate commits (by patch ID) - gitVC ++ LNK Errors with GLFW - c ++How do I find the location of S3 automatic backups created by Amazon RDS? - mysqlAll Articles