#30912 [Opn->Bgs]: array_multisort was broken
| From: | tony2001@php.net | Date: | Sat, 27 Nov 2004 07:08:54 +0000 |
| Subject: | #30912 [Opn->Bgs]: array_multisort was broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-69507@lists.php.net to get a copy of this message | ||
ID: 30912
Updated by: tony2001@php.net
Reported By: bolk at hitv dot ru
-Status: Open
+Status: Bogus
-Bug Type: Unknown/Other Function
+Bug Type: Arrays related
Operating System: Linux RedHat
PHP Version: 4.3.10RC1
New Comment:
That's how array_multisort() works.
"The first array is the primary one to sort by. The rows (values) in
that array that compare the same are sorted by the next input array,
and so on."
Take a look at examples in docs - they show pretty same behaviour and
that's really expected.
Previous Comments:
------------------------------------------------------------------------
[2004-11-26 15:44:18] bolk at hitv dot ru
Description:
------------
array_multisort was broken
Reproduce code:
---------------
$rel2 = array(17, 100, 100, 100, 100, 100, 100, 100, 17, 17, 17, 17,
17);
$rel = array('a','b', 'c', 'd', 'e',
'f', 'g', 'h',
'x','y','z','xx','ww');
array_multisort ($rel2, SORT_NUMERIC, SORT_DESC, $rel, SORT_REGULAR
);
print_r($rel2);
Expected result:
----------------
Array
(
[0] => 100
[1] => 100
[2] => 100
[3] => 100
[4] => 100
[5] => 100
[6] => 100
[7] => 17
[8] => 17
[9] => 17
[10] => 17
[11] => 17
[12] => 17
)
Actual result:
--------------
Array
(
[0] => 17
[1] => 100
[2] => 100
[3] => 100
[4] => 100
[5] => 100
[6] => 100
[7] => 100
[8] => 17
[9] => 17
[10] => 17
[11] => 17
[12] => 17
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30912&edit=1