I have an associative array like this:
$arr = array('id' => 3, 'title' => 'lorem ipsum');
Now, I want to remove first element from array regardless of it's key, because 'id' can sometimes be 'm_id', 'e_id'...
That is why I can't use unset['id'], but I can't use unset[0] either, because 0 is not it's key.
How do I do that?
array_shift($arr);
For the array
$arr = array('id' => 3, 'title' => 'lorem ipsum');
, this will return 3
and change the array $arr
to $arr = array('title' => 'lorem ipsum');
.
0 comments:
Post a Comment