Re: [RFC] array_key_(first|last|index) functions proposal

From: Date: Fri, 01 Jan 2016 21:38:47 +0000
Subject: Re: [RFC] array_key_(first|last|index) functions proposal
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-89956@lists.php.net to get a copy of this message
On Fri, Jan 1, 2016 at 3:44 PM, John Bafford <jbafford@zort.net> wrote: > Happy New Year, everyone! > > I’d like to present the first new PHP RFC for this year, a proposal to add > functions to easily get the first, last, or an arbitrary key (and value) by > index from an array, taking advantage of PHP’s property that arrays are > ordered maps. > Thanks for submitting this RFC! I am +1, with one quibble: obtaining the value by reference seems non-sequitur to the function itself and PHP in general. IOW, this seems more PHPesque to me: // get the next to last value $key = array_key_index($arr, -2); $val = $arr[$key]; Sincerely, bishop

« previous php.internals (#89956) next »