Re: [RFC] [Discussion] array_first() and array_last()
| From: | Juris Evertovskis | Date: | Sun, 06 Apr 2025 17:06:25 +0000 |
| Subject: | Re: [RFC] [Discussion] array_first() and array_last() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127061@lists.php.net to get a copy of this message | ||
On 2025-04-05 18:51, 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 NielsHi, Do you think it would be hard or wrong to add
array_nth? I've had more trouble with that as the in-place implementation is usually pretty unreadable, e.g.
array_slice(array_values($array), $offset, 1)[0] ?? nullI understand this need is less common, especially compared to
array_first. But I also suspect that an in-engine implementation might have more performance gains compared to an userland one.
BR,
Juris