note 10119 deleted from function.array-multisort by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 21:06:01 +0000 |
| Subject: | note 10119 deleted from function.array-multisort by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25467@lists.php.net to get a copy of this message | ||
attention, si une case d'un tableau à 2 dimension ne contient rien, alors le tri se fait mal
exemple:
$TAB[0][0]="TOTO";
$TAB[1][0]="toto";
$TAB[0][1]="TITI";
$TAB[1][1]="titi";
$TAB[0][2]="TATA";
$TAB[1][2]="";
reset($TAB);
while (list($i,$val)=each($TAB)){
while (list($j,$vale)=each($TAB[$i])) echo "TAB[$i][$j]=$vale <br>";
}
echo "----<br>";
array_multisort ($TAB[0],SORT_ASC ) ;
reset($TAB);
while (list($i,$val)=each($TAB)){
while (list($j,$vale)=each($TAB[$i])) echo "TAB[$i][$j]=$vale <br>";
}
Ce qui donne l'affichage:
TAB[0][0]=TOTO
TAB[0][1]=TITI
TAB[0][2]=TATA
TAB[1][0]=toto
TAB[1][1]=titi
TAB[1][2]=
----
TAB[0][0]=TATA
TAB[0][1]=TITI
TAB[0][2]=TOTO
TAB[1][0]=toto
TAB[1][1]=titi
TAB[1][2]=