On Sun, Apr 20, 2025 at 9:30 AM Niels Dossche <dossche.ni...@gmail.com> wrote: > > On 05/04/2025 17: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 > > I'll be putting this to vote on Tuesday 22nd if no one has complaints. > > Kind regards > Niels
In the section "Why include this in the engine rather than userland?", there is this comment: > Very fast implementation, faster than a PHP implementation in > my brief tests. Further optimization is possible by > implementing an additional frameless variant, but that's > future material if ever necessary/interesting. I think array_first and array_last are good candidates for being frameless, as they are quite cheap functions, so lowering their overhead further is nice. Additionally, they don't call into user code, so the chance that this function will be included in a stack trace is quite low. These arguments also apply to array_key_first and array_key_last, of course. I don't think it blocks this RFC in any way, and could be made frameless after the vote--I just wanted to bring up that I think they _should_ be frameless if they get accepted (and update array_key_first/array_key_last to be frameless too).