Bug #52733 [Com]:
| From: | phpstars at gmail dot com | Date: | Mon, 30 Aug 2010 04:56:20 +0000 |
| Subject: | Bug #52733 [Com]: | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153908@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52733&edit=1
ID: 52733
Comment by: phpstars at gmail dot com
Reported by: phpstars at gmail dot com
Summary:
Status: Bogus
Type: Bug
Package: Output Control
Operating System: Windows 7
PHP Version: 5.3.3
Block user comment: N
New Comment:
So the correct code:
$array1 = array (2,3,1,5,4);
$array2 = array (7,8,6,10,9);
array_multisort($array1,$array2);
Thanks for your attention
Previous Comments:
------------------------------------------------------------------------
[2010-08-30 03:02:34] rasmus@php.net
That's not a bug. You are confused about how array_multisort() works.
Read the
documentation again and look at the examples. The output you are
getting is the
expected output. The second array is put in the same order as the
first.
------------------------------------------------------------------------
[2010-08-30 02:50:54] phpstars at gmail dot com
Description:
------------
I found this problem , use the latest version of XAMPP
<?PHP
$array1 = array (4,3,1,5,2);
$array2 = array (7,9,6,10,8);
array_multisort($array1,$array2);
print_r ($array1); // Result : Array ( [0] => 1 [1] => 2 [2] => 3 [3] =>
4 [4] => 5 )
echo '<BR>';
print_r ($array2); // Result : Array ( [0] => 6 [1] => 8 [2] => 9 [3] =>
7 [4] => 10 )
// Note : Number 7 in the $array2 sorted after number 9
echo '<BR><HR><BR>';
$array1 = array (4,3,1,5,2);
$array2 = array (7,9,6,10,8);
array_multisort($array1);
array_multisort($array2);
print_r ($array1); // Result : Array ( [0] => 1 [1] => 2 [2] => 3 [3] =>
4 [4] => 5 )
echo '<BR>';
print_r ($array2); // Result : Array ( [0] => 6 [1] => 7 [2] => 8 [3] =>
9 [4] => 10 )
// Note : But when array_multisort($array2); separately was used, the
output was correct
?>
Test script:
---------------
Expected result:
----------------
Actual result:
--------------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52733&edit=1