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/
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