#30912 [Bgs]: array_multisort was broken
| From: | bolk at hitv dot ru | Date: | Sat, 27 Nov 2004 11:01:14 +0000 |
| Subject: | #30912 [Bgs]: array_multisort was broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-69512@lists.php.net to get a copy of this message | ||
ID: 30912
User updated by: bolk at hitv dot ru
Reported By: bolk at hitv dot ru
Status: Bogus
Bug Type: Arrays related
Operating System: Linux RedHat
PHP Version: 4.3.10RC1
New Comment:
Hm... But in previos versions (for expample PHP 4.3.9) my example works
fine. Thank for your help.
Previous Comments:
------------------------------------------------------------------------
[2004-11-27 08:08:47] tony2001@php.net
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.
------------------------------------------------------------------------
[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