I have an array where I want to use array_slice to remove the first element of the array. Here's the command:
$myArray = array_slice($myArray, 1);
Now, array_slice has a 4th argument, when set to true, it preserves the array keys instead of resetting them. I do need this option set to true.
The 3rd argument is to specify the length of the resulting array. You are supposed to leave this argument out if you want the array to be sliced to the end of the array instead of specifying a length.
So I tried this:
$myArray = array_slice($myArray, 1, NULL, true);
And this results in an empty array. What am I doing wrong? Is there another way to "leave out" the length argument without setting it to NULL? Because setting it to NULL seems to empty my array completely.
Also, my workaround is to do this:
$myArray = array_slice($myArray, 1, count($myArray)-1, true);
but it doesn't seem like I should have to do that...
UPDATE
This appears to be a bug with PHP 5.1.6