note 97046 added to function.sort

From: Date: Mon, 29 Mar 2010 21:16:56 +0000
Subject: note 97046 added to function.sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-167511@lists.php.net to get a copy of this message
If you need to sort an array containing some equivalent values and you want the equivalents to end up next to each other in the overall order (similar to a MySQL's ORDER BY output), rather than breaking the function, do this: <?php sort($array, ksort($array)) ?> -When the sort() function finds two equivalents, it will sort them arbitrarily by their key #'s as a second parameter. -Dirk ---- Server IP: 69.147.83.197 Probable Submitter: 66.213.33.136 ---- Manual Page -- http://www.php.net/manual/en/function.sort.php Edit -- https://master.php.net/note/edit/97046 Del: integrated -- https://master.php.net/note/delete/97046/integrated Del: useless -- https://master.php.net/note/delete/97046/useless Del: bad code -- https://master.php.net/note/delete/97046/bad+code Del: spam -- https://master.php.net/note/delete/97046/spam Del: non-english -- https://master.php.net/note/delete/97046/non-english Del: in docs -- https://master.php.net/note/delete/97046/in+docs Del: other reasons-- https://master.php.net/note/delete/97046 Reject -- https://master.php.net/note/reject/97046 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167511) next »