Hello Internals,
I'd like to ask for feedback for my idea. Some years ago a pull request came up to add array_key_first(), array_key_last(), and array_key_index() functions (#347 https://github.com/php/php-src/pull/347). In the meantime a RFC was published to integrate the functions (https://wiki.php.net/rfc/array_key_first_last_index) which was discussed in the mailing list two and a half years ago (https://externals.io/message/89955).
Since the pull request and the RFC doesn't sustain a real progress and in my opinion at least the functions array_key_first(array $a) and array_key_last(array $a) would be handy in some cases I'd like to propose using a smaller functional scope as a first step including only this two functions.
Additional features like returning the value of the requested element or the function array_key_index() could be implemented in a later stage if required.
I implemented those two functions in a different implementation approach which tries to use as much existing code as possible available and already created a pull request at https://github.com/php/php-src/pull/3256.
For the next steps I'd like to create a new RFC as the functional scope differs to the existing RFC. Therefor I request a PHP.net wiki account (wiki username: wol-soft) to create a new RFC.
Regards,
Enno
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus
Hi Christoph,
You should have RFC karma now.
Thanks for the RFC karma, everything worked fine.
I've created a new RFC for this topic located at https://wiki.php.net/rfc/array_key_first_last
Thanks,
Enno
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus
Em ter, 12 de jun de 2018 às 07:04, Côme Chilliet come@opensides.be escreveu:
Quoted text · 4 lines
Hello,
Shouldn’t we also add array_first and array_last for consistency? reset and end may be used for this but they modify the array state and cannot be called on function results.
Côme
--
Hi Côme,
Thanks for bringing the discussion about array_first and array_last. I'm pretending to code it and propose those in the next version of PHP after PHP 7.3, with the names array_find_first and array_find_last :)
Thanks,
Gabriel Caruso