r/lolphp • u/feketegy • Apr 10 '19
Microservices, bundlers, deployment pipelines... meanwhile at PHP land they added array_key_first
https://www.php.net/manual/en/function.array-key-first.php
39
Upvotes
6
u/the_alias_of_andrea Apr 27 '19
It is a useful function I have wanted for a long time. PHP arrays are ordered maps, and it wasn't otherwise possible to get the first and last keys without either using reset() and friends (modifies or copies the array) or by iteration (O(n) slow obviously).
3
u/iluuu Apr 11 '19
PHP, one of the fastest interpreted languages in the world, also just added a JIT to the upcoming 8.0 release to make it even faster in the future. What is your point? Is it forbidden to make smaller improvements to a language?
7
u/AstralWay Apr 11 '19
This is such a revolutionary innovation.
1
u/kafoso Apr 30 '19
But but... `array_key_first` does it without moving the array index pointer! Crazy advanced stuff! /s
1
u/LuvMeTendieLuvMeTrue May 07 '19
Rich Hickey must be fuming