Re: [PHP-DEV] Proposal: addition of array_find() and array_find_key() functions

2023-06-01 Thread Hans Henrik Bergan
sounds like array_find could be implemented by just adding a new flag for array_filter's $mode: ARRAY_FILTER_STOP_ON_FIRST_MATCH or some such? On Fri, 2 Jun 2023 at 02:15, Casper Langemeijer wrote: > > On Thu, Jun 1, 2023, at 18:02, Janusz Szczypka wrote: > > array_find(): This function would all

Re: [PHP-DEV] Proposal: addition of array_find() and array_find_key() functions

2023-06-01 Thread Casper Langemeijer
On Thu, Jun 1, 2023, at 18:02, Janusz Szczypka wrote: > array_find(): This function would allow developers to find the first element > in > an array that satisfies a specific condition. The condition would be defined > by a callback function. This would actually be an alternative to a simple fo

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-06-01 Thread Casper Langemeijer
On Thu, Jun 1, 2023, at 11:56, Boro Sitnikovski wrote: > Thank you for the suggestion, I like this approach and it's definitely much > "safer" than going with an RFC for core directly. > > What are your thoughts on creating a PECL extension called `array_utils` > (selling point would be high per

[PHP-DEV] RFC Karma

2023-06-01 Thread Nick Humphries
Hi Internals, As per my earlier post discussing the concept of an RFC to add public properties to interfaces, I would like to request karma to create this RFC. Thanks, Nick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Proposal: addition of array_find() and array_find_key() functions

2023-06-01 Thread Jorg Sowa
Hey, Native implementation of the function array_find would decrease number of lines needed to perform basic loops over the arrays from 4-6 lines to just 1. And I recollect a few times when the argument of reducing lines of code needed to type was a valid reason of implementing the change. Moreove

Re: [PHP-DEV] Proposal: addition of array_find() and array_find_key() functions

2023-06-01 Thread Tim Düsterhus
Hi On 6/1/23 18:29, Larry Garfield wrote: As with the array_group thread: What is the argument to put these functions in hard to update C, rather than PHP that is easy to download with Composer? "could be a nice addition" is not a compelling argument. Is it substantially faster? It is trul

Re: [PHP-DEV] Proposal: addition of array_find() and array_find_key() functions

2023-06-01 Thread Larry Garfield
On Thu, Jun 1, 2023, at 4:02 PM, Janusz Szczypka wrote: > Dear PHP Internals, > > I would like to propose new functions to search in arrays: array_find() and > array_find_key(). > > array_find(): This function would allow developers to find the first > element in > an array that satisfies a specif

[PHP-DEV] [RFC] [VOTE] Define proper semantics for range() function

2023-06-01 Thread G. P. B.
Hello internals, The vote for the Define proper semantics for range() function RFC is now open and will last for two weeks until the 15th of June 2023: https://wiki.php.net/rfc/proper-range-semantics Best regards, George P. Banyard

[PHP-DEV] Proposal: addition of array_find() and array_find_key() functions

2023-06-01 Thread Janusz Szczypka
Dear PHP Internals, I would like to propose new functions to search in arrays: array_find() and array_find_key(). array_find(): This function would allow developers to find the first element in an array that satisfies a specific condition. The condition would be defined by a callback function

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-06-01 Thread Boro Sitnikovski
> On 1.6.2023, at 09:18, Casper Langemeijer wrote: > > On Thu, Jun 1, 2023, at 01:19, Boro Sitnikovski wrote: >> Thank you for the information and encouragement! I was a bit scared of this >> one being rejected too, but still decided to give it a shot :) > > As an alternative approach this i

Re: [PHP-DEV] [RFC] [Discussion] Add new function `array_group`

2023-06-01 Thread Casper Langemeijer
On Thu, Jun 1, 2023, at 01:19, Boro Sitnikovski wrote: > Thank you for the information and encouragement! I was a bit scared of this > one being rejected too, but still decided to give it a shot :) As an alternative approach this is what I would do in your situation: I would start with a PHP im