php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32817 array_multisort
Submitted: 2005-04-25 04:55 UTC Modified: 2005-04-25 10:05 UTC
From: tianlin dot wang at sas dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.0.4 OS: REDHAT 9
Private report: No CVE-ID:
 [2005-04-25 04:55 UTC] tianlin dot wang at sas dot com
Description:
------------
It seems to me that array_multisort() is not working properly (does not sort at all) for a reference to an array. The example code is listed below. I noticed that sort() works properly.

<?PHP
$p['us'] = array();
$arr = &$p['us'];
$arr[]=4;
$arr[]=2;
$arr[]=1;
$arr[]=5;
array_multisort($arr);
//sort($arr); this works properly.

for ($i=0; $i<count($arr); $i++) {
   echo($arr[$i]);
   echo("\n");
}
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-25 10:05 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #25359 (same reason: reference)

 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 14:02:33 2014 UTC