note 39598 added to function.array-multisort

From: Date: Tue, 03 Feb 2004 20:16:05 +0000
Subject: note 39598 added to function.array-multisort
Groups: php.notes 
Request: Send a blank email to php-notes+get-64614@lists.php.net to get a copy of this message
"SQL ORDER BY" like , in a "Database Table like" Array. <? //Fill a simple "Table Like" array: for ($i = 0; $i <= 10; $i=$i+1){ $aTable["Fied1"][]=$i; $aTable["Fied2"][]=-$i; $aTable["Fied3"][]=$i*2; $aTable["Fied4"][]=$i+$i; $aTable["Fied5"][]=5; $aTable["Fied6"][]=45; } //Sort aTable, order by Field1,Field2: array_multisort( $aTable["Fied1"], $aTable["Fied2"], $aTable["Fied3"], $aTable["Fied4"], $aTable["Fied5"], $aTable["Fied6"] ); print_r($aTable); //Sort aTable, order by Field2,Field3: array_multisort( $aTable["Fied2"], $aTable["Fied3"], $aTable["Fied1"], $aTable["Fied4"], $aTable["Fied5"], $aTable["Fied6"] ); print_r($aTable); ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-multisort.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39598 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39598&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39598&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64614) next »