Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61203 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75999 invoked from network); 13 Jul 2012 16:11:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2012 16:11:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajfweb@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajfweb@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: ajfweb@googlemail.com X-Host-Fingerprint: 74.125.82.42 mail-wg0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:50704] helo=mail-wg0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/88-17670-BB840005 for ; Fri, 13 Jul 2012 12:11:40 -0400 Received: by wgbfm10 with SMTP id fm10so647013wgb.5 for ; Fri, 13 Jul 2012 09:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=U/7prhPUT5xseBAdk6/bLUQleGWbXibTx2etjcAqvlM=; b=sakQoV5pyByweM1yupzoHHwJ+Qkfhw2lSk02DzJmqq/xt788GDJoJ2jkZ9ioedKKI4 svooMV7hTuhvEWyKz9j+1/plLgEodvJtjzx4GPDeJXWkcNajCudpt/+wxM8sXdY24AnZ +xe6mS5EIoCgSP/9K9W3n33RpxKmp8a20X9FOZUFhNC0+tY+8wUVHSFDX1+SfH+mxfXX C42SlM/lZONfya+31DQs+cYWsmiK4vtubfwscPTV7KfC532NBVIWbzb6PaYKjiKM84E8 IhW2W+2W1hqOLOJeWSxZiXMlZGJUwzPfTt5E1Y6gI0IFSV0bBl3jqBzzCYgp6Wtm+9xV AB5g== Received: by 10.216.243.71 with SMTP id j49mr981885wer.224.1342195896819; Fri, 13 Jul 2012 09:11:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.71.199 with HTTP; Fri, 13 Jul 2012 09:11:16 -0700 (PDT) Date: Fri, 13 Jul 2012 17:11:16 +0100 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: [request #48542] addition of optional second parameter to array_shift/array_pop which gives key From: ajfweb@googlemail.com (Andrew Faulds) Hi there, I saw this bug report (feature request): https://bugs.php.net/bug.php?id=48542 The person there proposes that array_shift and array_pop should have an optional second parameter, which can be passed a reference to a variable in which the key can be returned, so you can pop the key and value at the same time, rather than having to get the key first, then pop the pair to get the value. Thoughts? I'm new to PHP development, I thought this might be a useful feature that I could relatively easily implement. Also, I can personally see how this could be useful having used arrays as essentially look-up tables before. -- Andrew Faulds (AJF) http://ajf.me/