On Sat, Apr 5, 2025, at 10:51 AM, Niels Dossche wrote:
> Hi internals
>
> I'm opening the discussion for the RFC "array_first() and array_last()".
> https://wiki.php.net/rfc/array_first_last
>
> Kind regards
> Niels

To add another argument: the reset() workaround doesn't work with a readonly 
array property, because it does modify the array's internal pointer.

https://3v4l.org/Zo5dZ

Yes, I have in fact run into this situation in real code, which led me to use 
the $a[array_key_first($a)] dance instead.  I'd love to replace it with a 
single call.

--Larry Garfield

Reply via email to