note 73525 added to function.array-multisort

From: Date: Tue, 27 Feb 2007 21:23:12 +0000
Subject: note 73525 added to function.array-multisort
Groups: php.notes 
Request: Send a blank email to php-notes+get-123935@lists.php.net to get a copy of this message
When using array_multisort() on copies of arrays, it is changing all the copies, even if you modify the copy before using array_multisort(). I've avoided this bug by serializing a copy of array before calling array_multisort, and unserializg it after array_multisort() Look at the code: <?php $records_copy = serialize($records) ; array_multisort ( $records[$sort_field] , $records[$sort2_field] ) ; $records_copy = unserialize($records_copy) ; ?> ---- Server IP: 195.136.184.34 Probable Submitter: 85.193.206.251 ---- Manual Page -- http://www.php.net/manual/en/function.array-multisort.php Edit -- https://master.php.net/note/edit/73525 Del: integrated -- https://master.php.net/note/delete/73525/integrated Del: useless -- https://master.php.net/note/delete/73525/useless Del: bad code -- https://master.php.net/note/delete/73525/bad+code Del: spam -- https://master.php.net/note/delete/73525/spam Del: non-english -- https://master.php.net/note/delete/73525/non-english Del: in docs -- https://master.php.net/note/delete/73525/in+docs Del: other reasons-- https://master.php.net/note/delete/73525 Reject -- https://master.php.net/note/reject/73525 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123935) next »