On 07/14/2012 10:13 AM, Anthony Ferrara wrote:
> Gustavo,
> 
> Why is the last key special? Why not a function to get the first or the
>> penultimate key?
>>
> 
> How would such a function look?

I think the function would look just like the function we have for doing
this.

key(array_slice($arr,-2));

And no, this has no side-effect of changing the array pointer in $arr,
of course.

And array_last_key() is identical to array_slice($arr,-1) is it not?

The only thing array_last_key() saves is a single function call to
key(). That doesn't seem worth it to me.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to