Bug #16778: usort and uasort work only if you give them your array BY REFERENCE.

From: Date: Wed, 24 Apr 2002 00:09:12 +0000
Subject: Bug #16778: usort and uasort work only if you give them your array BY REFERENCE.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-5753@lists.php.net to get a copy of this message
From: jeremy@titr.uow.edu.au Operating system: Linux PHP version: 4.1.2 PHP Bug Type: Arrays related Bug description: usort and uasort work only if you give them your array BY REFERENCE. The following code doesn't work : $received_array = uasort($send_array,"mycmp") $received_array isn't a correct array (but the integer 1 in general) Where if I do this : $received_array = uasort(&$send_array,"mycmp") $received_array is still not correct, but $send_array has been sorted. -- Edit bug report at http://bugs.php.net/?id=16778&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16778&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16778&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16778&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16778&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16778&r=support Expected behavior: http://bugs.php.net/fix.php?id=16778&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16778&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16778&r=submittedtwice

« previous php.bugs (#5753) next »