Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89956 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84569 invoked from network); 1 Jan 2016 21:39:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jan 2016 21:39:20 -0000 Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wm0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:33348] helo=mail-wm0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/12-06661-702F6865 for ; Fri, 01 Jan 2016 16:39:20 -0500 Received: by mail-wm0-f53.google.com with SMTP id f206so119166229wmf.0 for ; Fri, 01 Jan 2016 13:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=Df5exLka5exdj+JiKLddSIIRrlHkkohXsHEFHAizmlM=; b=S56e+kGC6VbbyBInIZ2sP8VgDASuU7vQntLUQiighdS2cN4rDkJi8rST2YPz0si1lv GISWcxz9+MTuvnU8FqsDC//YwJk4EHgv5TkhJD91cG/1FN7EUfrt47FiTFRIaQVebsd+ 0o2nfnghQleWL/nmWwdfnoluAe7/6THrU561QsXEPir00TjkJ3fSw9gi2ryKe4/m/xnN CuA1baL4L6S+P79t2Iq02HDQLPJ/dYi5IFmJiRz+71Af6Bm1PHEthnF6hhvokyjyOUvO vAPsMqdGkkZjz+6VRgR6fU7uIbt5hBF3mJ9yAgpPXBFpKuVairdg+5vU2eauyTNb8NW3 M4kQ== X-Received: by 10.28.148.82 with SMTP id w79mr79429672wmd.71.1451684356670; Fri, 01 Jan 2016 13:39:16 -0800 (PST) MIME-Version: 1.0 Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.194.45.230 with HTTP; Fri, 1 Jan 2016 13:38:47 -0800 (PST) In-Reply-To: <070A1824-9ED7-4863-92AB-A4366AB92C98@zort.net> References: <070A1824-9ED7-4863-92AB-A4366AB92C98@zort.net> Date: Fri, 1 Jan 2016 16:38:47 -0500 X-Google-Sender-Auth: xFzWKp1-qU5Qq_QVNOh7tdJAEe0 Message-ID: To: John Bafford Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114b6fc467cae205284c9a32 Subject: Re: [PHP-DEV] [RFC] array_key_(first|last|index) functions proposal From: bishop@php.net (Bishop Bettini) --001a114b6fc467cae205284c9a32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Jan 1, 2016 at 3:44 PM, John Bafford wrote: > Happy New Year, everyone! > > I=E2=80=99d like to present the first new PHP RFC for this year, a propos= al to add > functions to easily get the first, last, or an arbitrary key (and value) = by > index from an array, taking advantage of PHP=E2=80=99s property that arra= ys 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 =3D array_key_index($arr, -2); $val =3D $arr[$key]; Sincerely, bishop --001a114b6fc467cae205284c9a32--