Re: [RFC] [Discussion] array_first() and array_last()
| From: | Bilge | Date: | Mon, 07 Apr 2025 04:43:11 +0000 |
| Subject: | Re: [RFC] [Discussion] array_first() and array_last() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127065@lists.php.net to get a copy of this message | ||
On 07/04/2025 01:47, Ayesh Karunaratne wrote:
To be clear, I wasn't disputing first/last, but nth, but thanks for the insights! Cheers, BilgeOn Mon, Apr 7, 2025 at 2:05 AM Bilge <bilge@scriptfusion.com> wrote: ... [snip] I suggest first proving there is a legitimate need.I did a quick GitHub search for a common pattern of accessing an array value by using thearray_key_firstandarray_key_lastfunctions:$value = $arr[array_key_first($results)];-[array_key_first(: over 3,700 results[^1] -[array_key_last(: over 4,300 results[^2] All of these hits can benefit from the proposedarray_firstandarray_last.