note 112677 added to function.asort

From: Date: Thu, 11 Jul 2013 20:10:20 +0000
Subject: note 112677 added to function.asort
Groups: php.notes 
Request: Send a blank email to php-notes+get-195577@lists.php.net to get a copy of this message
Careful - this function may change the order of elements when the values are exactly the same. Consider this: $data = array('Alpha' => 1, 'Beta' => 1); asort($data, SORT_NUMERIC); The values or these 2 elements are the same so you probably expect that the original order will not change but in fact the result of $data will be: Array ( [Beta] => 1 [Alpha] => 1 ) Tested this in php 5.3.10, not sure about the behaviour in other versions. ---- Server IP: 69.147.83.199 Probable Submitter: 170.146.225.4 ---- Manual Page -- http://php.net/manual/en/function.asort.php Edit -- https://master.php.net/note/edit/112677 Del: integrated -- https://master.php.net/note/delete/112677/integrated Del: useless -- https://master.php.net/note/delete/112677/useless Del: bad code -- https://master.php.net/note/delete/112677/bad+code Del: spam -- https://master.php.net/note/delete/112677/spam Del: non-english -- https://master.php.net/note/delete/112677/non-english Del: in docs -- https://master.php.net/note/delete/112677/in+docs Del: other reasons-- https://master.php.net/note/delete/112677 Reject -- https://master.php.net/note/reject/112677 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195577) next »