Req #48542 [Fbk->NoF]: array_shift/_pop should fetch the key

From: Date: Tue, 30 Dec 2014 10:41:34 +0000
Subject: Req #48542 [Fbk->NoF]: array_shift/_pop should fetch the key
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189390@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48542&edit=1 ID: 48542 Updated by: php-bugs@lists.php.net Reported by: simon at stienen dot name Summary: array_shift/_pop should fetch the key -Status: Feedback +Status: No Feedback Type: Feature/Change Request Package: Arrays related PHP Version: 5.3.0RC3 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2014-04-16 21:59:29] levim@php.net Is this something you are still interested in? I think array_pop and array_shift are designed to work with stack and queue like behavior, so the key is completely irrelevant. ------------------------------------------------------------------------ [2009-06-13 10:46:38] simon at stienen dot name Description: ------------ The functions array_shift and array_pop should get an optional second parameter, taking a reference to a variable in which the key of the shifted/popped element will be stored. Reproduce code: --------------- <?php $a = array( 'foo' => 'bar', 'qux' => 'quux' ); $value = array_shift($a, $key); echo "$key: $value"; Expected result: ---------------- foo: bar Actual result: -------------- array_shift does not take a second parameter at the moment. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=48542&edit=1

« previous php.bugs (#189390) next »