Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61220 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23128 invoked from network); 14 Jul 2012 02:04:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2012 02:04:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:48123] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/84-20866-EA3D0005 for ; Fri, 13 Jul 2012 22:04:31 -0400 Received: by weyr1 with SMTP id r1so3087153wey.29 for ; Fri, 13 Jul 2012 19:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=l34FZAzhhxlKGr2hrlSsCeHs9ABh+VxxaktMRn1+x/Q=; b=TF5KtqtQj3J7Zo7+pl+PiP4LckRB5DWTFgE+n1a4jFw5ITneBiNNzKr5oUgByV+co+ sf2KWx1fRrkl696mAs69z+2jGxBjNiiWm4AXqNwZgSKFbQFwGhuk6O6sHIl1vIfLCHUR uV5vDHIqTxKpYfgklts8vQoLeT6JuExOybXMpdhac/ebYMd6vz1vy5dOrW6A/Hpo5iBh XaYWkhm7X31DlULFuhku867dih7vmJuJxwALU2KV6F+LLMZzR2FYB9CLBJL+Dw6yibmA WLgKqtJDB02kHcs8H/AXdSTNGqkso7s0V4gaZNZONtqN14yVZB8r7eIQUNwP7FpfDcC3 2PnQ== MIME-Version: 1.0 Received: by 10.180.88.229 with SMTP id bj5mr2109082wib.19.1342231467873; Fri, 13 Jul 2012 19:04:27 -0700 (PDT) Received: by 10.180.103.195 with HTTP; Fri, 13 Jul 2012 19:04:27 -0700 (PDT) In-Reply-To: <5000BF44.3080907@sugarcrm.com> References: <5000BF44.3080907@sugarcrm.com> Date: Fri, 13 Jul 2012 22:04:27 -0400 Message-ID: To: Stas Malyshev Cc: Brandon Wamboldt , Andrew Faulds , internals Content-Type: multipart/alternative; boundary=f46d04426740d955a404c4c09dc1 Subject: Re: [PHP-DEV] Re: array_last_key() function From: ircmaxell@gmail.com (Anthony Ferrara) --f46d04426740d955a404c4c09dc1 Content-Type: text/plain; charset=ISO-8859-1 Stas, > I like this idea. array_first_key would be nice too > > I am probably missing something, but what those would allow to do that > rewind/end+key() doesn't do? > The big thing that it does that end()+key() doesn't do is really what it doesn't do (update the internal pointer). end() modifies the array pointer. So if you try this in user-land: function array_last_key(array $array) { end($array); return key($array); } It will always force a full copy of the array (at least the hash table). Implementing this as a core function however would eliminate that one side-effect... --f46d04426740d955a404c4c09dc1--