Re: [PHP-DEV] [RFC] [Discussion] array_first() and array_last()

2025-04-06 Thread Bilge
On 07/04/2025 01:47, Ayesh Karunaratne wrote: On Mon, Apr 7, 2025 at 2:05 AM Bilge 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 the `array_key_first` and `array_key_last` functions: `

Re: [PHP-DEV] [RFC] [Discussion] array_first() and array_last()

2025-04-06 Thread Larry Garfield
On Sun, Apr 6, 2025, at 7:47 PM, Ayesh Karunaratne wrote: >> On Mon, Apr 7, 2025 at 2:05 AM Bilge 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 the `array_key_first` and `array

Re: [PHP-DEV] [RFC] [Discussion] array_first() and array_last()

2025-04-06 Thread Ayesh Karunaratne
> On Mon, Apr 7, 2025 at 2:05 AM Bilge 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 the `array_key_first` and `array_key_last` functions: ```php $value = $arr[array_key_first($resul

Re: [PHP-DEV] [RFC] [Discussion] array_first() and array_last()

2025-04-06 Thread Bilge
On 06/04/2025 18:06, Juris Evertovskis wrote: I also suspect that an in-engine implementation might have more performance gains compared to an userland one. That applies to literally anything, obviously; one less layer of abstraction is always more efficient. That's therefore not a reason to

Re: [PHP-DEV] [RFC] [Discussion] array_first() and array_last()

2025-04-06 Thread Juris Evertovskis
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 th

Re: [PHP-DEV] RFC: blank() Function as a Complement to empty()

2025-04-06 Thread Iliya Miroslavov Iliev
On Sun, Apr 6, 2025 at 9:52 AM Hans Henrik Bergan wrote: > Maybe a > #[\SuppressUndefinedWarning] > > Parameter attribute could work, then everyone could implement their own > blank() function with their own preferred logic > > Not sure if it's technically feasible tho, now the php engine would n