Req #73735 [NEW]: array_column keys should be preserved

From: Date: Tue, 13 Dec 2016 21:27:06 +0000
Subject: Req #73735 [NEW]: array_column keys should be preserved
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205968@lists.php.net to get a copy of this message
From: photon0 at gmail dot com Operating system: ANY PHP version: Next Minor Version Package: Arrays related Bug Type: Feature/Change Request Bug description:array_column keys should be preserved Description: ------------ It would increase the usability of this function if it could preserve the array's keys in the result. I was expecting this to be the default behaviour. best regards, David Lévêsque Test script: --------------- $items = array( 1 => ["id" => 1], 2 => ["id" => 4], 3 => ["id" => 9], "four" => ["id" => 16] ); var_dump(array_column($items,"id")); Expected result: ---------------- array(4) { [0]=> int(1) [1]=> int(4) [2]=> int(9) ["four"]=> int(16) } Actual result: -------------- array(4) { [0]=> int(1) [1]=> int(4) [2]=> int(9) [3]=> int(16) } -- Edit bug report at https://bugs.php.net/bug.php?id=73735&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73735&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73735&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73735&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73735&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73735&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73735&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73735&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73735&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73735&r=support Expected behavior: https://bugs.php.net/fix.php?id=73735&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73735&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73735&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73735&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73735&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73735&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73735&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73735&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73735&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73735&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73735&r=mysqlcfg

« previous php.bugs (#205968) next »