Reputation:
I have an array like this:
$arr[0][0] = array('key' => 'value', 'key1' => 'value1', ...);
$arr[0][1] = array(...);
$arr[1][0] = array(...);
Now I would like to shift all items in $arr[0] to result in something like this:
$arr[0][0] = undefined;
$arr[0][1] = array('key' => 'value', 'key1' => 'value1', ...);
$arr[0][2] = array(...);
$arr[1][0] = array(...);
I tried this with for()
-loops, and while()
-loops, but both methods did not work for me, they are doing a mess with the result.
Upvotes: 0
Views: 652
Reputation: 10838
array_unshift($arr[0],'first elem');
array_unshift — Prepend one or more elements to the beginning of an array
Upvotes: 6