ID: 27788 Updated by: [EMAIL PROTECTED] Reported By: mail at spybreak dot de -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Win2K PHP Version: 4.3.4 Assigned To: andrei New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2004-03-31 02:08:59] [EMAIL PROTECTED] Making this a documentation problem, as it is the correct behavior. ------------------------------------------------------------------------ [2004-03-30 19:30:58] mail at spybreak dot de Description: ------------ The manual says that array_multisort mantains key associations. This is only true if the keys are strings. If the keys are integers on the other hand, key association is not mantained. I don't think that this is a bug since it's so obvious. But I wish feedback on this to clear this issue up. Thanks alot! Reproduce code: --------------- <? //names array. keys are user id's $names[5] = 'Peter'; $names[7] = 'Jim'; $names[11] = 'Martin'; $names[33] = 'John'; $names[34] = 'Robert'; //age array. keys are user id's $age[5] = 15; $age[7] = 19; $age[11] = 54; $age[33] = 29; $age[34] = 17; //sort names array by ages array_multisort($age, $names); var_dump($names); ?> Expected result: ---------------- I expect this: // _should_ return // // array // 5 => 'Peter' // 34 => 'Robert' // 7 => 'Jim' // 33 => 'John' // 11 => 'Martin' Actual result: -------------- // returns the following for me // // array // 0 => 'Peter' // 1 => 'Robert' // 2 => 'Jim' // 3 => 'John' // 4 => 'Martin' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27788&edit=1