[request #48542] addition of optional second parameter to array_shift/array_pop which gives key

From: Date: Fri, 13 Jul 2012 16:11:16 +0000
Subject: [request #48542] addition of optional second parameter to array_shift/array_pop which gives key
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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/


Thread (2 messages)

« previous php.internals (#61203) next »