Re: Proposal: addition of array_find() and array_find_key() functions

From: Date: Fri, 02 Jun 2023 09:01:26 +0000
Subject: Re: Proposal: addition of array_find() and array_find_key() functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-120511@lists.php.net to get a copy of this message
W dniu 2.06.2023 o 03:24, Hans Henrik Bergan pisze:
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?
array_filter is guaranteed to always return an array and we should not change it. Flags are used just to decide what should be sent to a callback. In my other e-mail I have just proposed adding similiar flags to array_find function as you have it now in array_filter, so it can be used to search by keys and/or values. Best regards, Janusz

« previous php.internals (#120511) next »