Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Woortmann, Enno
Hi Levi, Am 20.06.2018 um 04:47 schrieb Levi Morrison: list($key, $value) = array_first($input); // $key will be null if the call failed list($key, $value) = array_last($input); // $key will be null if the call failed Your proposed functions would be implementable with

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Woortmann, Enno
Am 20.06.2018 um 15:55 schrieb Levi Morrison: Your wish cannot be granted for `array_value_last` and `array_value_first`; you cannot know by itself if there is a failure condition. I can comprehend your issue with the lack of distinctness between the error case and the 'real' array value null

Re: [PHP-DEV] Re: [RFC][Under Discussion] Add functions array_key_first() and array_key_last()

2018-06-19 Thread Woortmann, Enno
Hello internals, On 15.06.2018 at 00:37, Enno Woortmann wrote: I've added the "Open Issues" section to the RFC and added the idea of Côme and Gabriel to add the corresponding functions for handling the values of the outer elements of an array to provide a complete set of functions. Currently I

Re: [PHP-DEV] Re:[PHP-DEV] [VOTE] array_key_first(),array_key_last(), array_value_first(),array_value_last()

2018-07-11 Thread Woortmann, Enno
Am 11.07.2018 um 18:20 schrieb Levi Morrison: As an example, it was claimed: If I use a function I expect it to give me a return value which I can use without any further post processing $wantedValue = fancyFunction($someInput); But this isn't true even for the array_value_* functions. There

[PHP-DEV] [VOTE] array_key_first(), array_key_last(), array_value_first(), array_value_last()

2018-07-09 Thread Woortmann, Enno
Hi, as the discussion got no new contributions I'd like to start the voting for the RFC fo add new functions for the handling of outer array elements. https://wiki.php.net/rfc/array_key_first_last To have a better separation I split up the vote for the functions. The first vote covers the

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-28 Thread Woortmann, Enno
Am 26.06.2018 um 16:42 schrieb Rowan Collins: On 26 June 2018 at 08:58, Marc Bennewitz wrote: Hi all, I just want to add some information that I feel it's missing in that discussion - I'm sorry if it was mentioned already. 1. It's already possible to extract the key and value of any index

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-28 Thread Woortmann, Enno
Hi David, thanks for your brainstorming suggestions. My opinion on the options: 1. Keys being stored as reference: $valueOutput = array_first(array $array, ?string &$keyOutput = null); In my opinion using references to return additional values from a function is quiet hacky. I think

[PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Woortmann, Enno
Hi internals, as I reviewed a bunch of code for handling data from different sources (eg. json) in the last days I stumbled over code like this multiple times: if (!(is_numeric($input['example1']) && is_numeric($input['example2']))) { if (!is_numeric($input['example1'] ||