Bug #11372 Updated: array_multisort does not maintain key association

From: Date: Wed, 27 Feb 2002 02:40:57 +0000
Subject: Bug #11372 Updated: array_multisort does not maintain key association
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-1140@lists.php.net to get a copy of this message
ID: 11372 Updated by: yohgaki@php.net Reported By: rkenny@mke.catalystwms.com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Windows NT 4.0 SP6a PHP Version: 4.0.5 New Comment: The version of PHP that this bug was reported in is too old. Please try to reproduce this bug in the latest version of PHP (available from http://www.php.net/downloads.php If you are still able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". I think this is fixed. If not, please reopen. Previous Comments: ------------------------------------------------------------------------ [2001-06-08 22:09:48] rkenny@mke.catalystwms.com Here's a quick script to reproduce the problem: <? $x = array ("filename" => array (0 => "joe.doc", 1 => "ralph.doc", 2 => "maria.xls") , "size" => array (0 => "jbig", 1 => "rsmall", 2 => "mmed") , "modified" => array (0 => "54", 1 => "32", 2 => "99") ); # array_multisort ($x["modified"]); asort ($x["modified"]); reset ($x["modified"]); echo "<p><b>Values in x</b><br>"; while (list ($key, $val) = each ($x)) { echo "$key => $val<br>"; } echo "<p><b>Values in filename</b><br>"; while (list ($key, $val) = each ($x["filename"])) { echo "$key => $val<br>"; } echo "<p><b>Values in size</b><br>"; while (list ($key, $val) = each ($x["size"])) { echo "$key => $val<br>"; } echo "<p><b>Values in modified</b><br>"; while (list ($key, $val) = each ($x["modified"])) { echo "$key => $val<br>"; } ?> Uncomment the "array_multisort" line and comment the "asort" line to witness the bug first hand. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=11372&edit=1

« previous php.bugs (#1140) next »