Trier un tableau associatif
Posté : 11 avr. 2008, 23:11
Bonjour,
Je veux trier un tableau associatif en fonction du deuxième élément "aplha2" :
Je dois faire une fausse manipe avec : array_multisort($toto, SORT_ASC, SORT_STRING);
Je voudrais trier en fonction du 2 eme elements ...
Je veux trier un tableau associatif en fonction du deuxième élément "aplha2" :
Code : Tout sélectionner
<?
$toto[0]=array("aplha"=>"A","aplha2"=>"F");
$toto[1]=array("aplha"=>"B","aplha2"=>"G");
$toto[2]=array("aplha"=>"C","aplha2"=>"H");
$toto[3]=array("aplha"=>"D","aplha2"=>"I");
$toto[4]=array("aplha"=>"E","aplha2"=>"J");
array_multisort($toto, SORT_ASC, SORT_STRING);
print("<pre>");
print_r($toto);
print("</pre>");
?>
Je voudrais trier en fonction du 2 eme elements ...