Bonjour,
Je n'arrive pas à trier un tableau dans l'ordre croissant pour un tableau multidimensionnel. Il trie seulement le premier chiffre. Comment faire?
Trier par position
Les positions sont par exemple: 1-2 ; 1-3 ; 1-1; 2-3; 2-1
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 $tableau=array(); while($item =mysql_fetch_array($requete)) { $tableau[]=array("id"=>$item["id"], "article"=>$item["nom_lot"], "position"=>$item["position"]); } // Obtient une liste de colonnes foreach ($tableau as $key => $row) { $id[$key] = $row['id']; $article[$key] = $row['article']; $position[$key] = $row['position']; } array_multisort($position, SORT_NUMERIC, SORT_ASC, $id, $article, $tableau);
cedric
Partager