Bug #16778 Updated: usort and uasort work only if you give them your array BY REFERENCE.
| From: | sniper@php.net | Date: | Wed, 24 Apr 2002 00:24:12 +0000 |
| Subject: | Bug #16778 Updated: usort and uasort work only if you give them your array BY REFERENCE. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-5756@lists.php.net to get a copy of this message | ||
ID: 16778
Updated by: sniper@php.net
Reported By: jeremy@titr.uow.edu.au
Status: Feedback
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4.1.2
New Comment:
And please add a complete, short script which can be used
to reproduce the problem.
--Jani
Previous Comments:
------------------------------------------------------------------------
[2002-04-23 20:23:35] sniper@php.net
The proto in PHP 4.2.0 for this function is:
bool uasort ( array array, function cmp_function)
Which means, that the fuction only returns TRUE or FALSE
depending whether it succeeded or not.
Please update to PHP 4.2.0 first.
--Jani
------------------------------------------------------------------------
[2002-04-23 20:09:11] jeremy@titr.uow.edu.au
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 this bug report at http://bugs.php.net/?id=16778&edit=1