Re: [RFC] [Discussion] array_first() and array_last()

From: 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 [email protected] 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 Niels
Hi, 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] ?? null
I 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

Thread (22 messages)

« previous php.internals (#127061) next »