Re: [request #48542] addition of optional second parameter to array_shift/array_pop which gives key
| From: | jpauli | Date: | Fri, 13 Jul 2012 16:17:28 +0000 |
| Subject: | Re: [request #48542] addition of optional second parameter to array_shift/array_pop which gives key | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61205@lists.php.net to get a copy of this message | ||
On Fri, Jul 13, 2012 at 6:11 PM, Andrew Faulds <ajfweb@googlemail.com> wrote:
> 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.
I'm +1 as this may be useful and there is no BC break.
Julien