note 17610 deleted from function.array-multisort by jimw

From: Date: Fri, 21 Dec 2001 00:32:00 +0000
Subject: note 17610 deleted from function.array-multisort by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23630@lists.php.net to get a copy of this message
/*********************************************************** * Please don't just look at this code, TRY IT! It will be * much clearer if you try it and play with it *********************************************************** * This code is meant to demo how this function actually * works and help clear up some confusion about how and * what array_multisort does I am posting this because * I was confused about it too, and almost filed a bug * report *********************************************************** * To use this code, just replace "...." with either a * tab or 4 spaces. *********************************************************** */ $testArray = array( ....array('e', 'g', 'a', 'c', 'l'), ....array('0', '1', '2', '3', '4'), ....array('5', '6', '7', '8', '9') ); echo "<hr>Before Sorting:"; printArray($testArray); array_multisort( ....$testArray[0], ....$testArray[1], ....$testArray[2] ); echo "After Sorting:"; printArray($testArray); function printArray($ar) { ....echo '<table border=1 cellpadding=2 cellspacing=2><tr>'; ....foreach ($ar as $innerArray) { ........echo '<td>'; ........foreach ($innerArray as $data) { ............echo "$data<hr>"; ........} ........echo '</td>'; ....} ....echo '</tr></table><hr>'; }

« previous php.notes (#23630) next »