Je souhaite trier un tableau du plus petit au plus grand ou inversement. J'ai lu beaucoup de choses, j'ai essayé array_multisort mais je n'arrive pas à obtenir le résultat escompté.
Voici le début de mon array (qui comporte entre 5 et 30 résultats suivant les résultats)
Code : Tout sélectionner
array (size=42)
0 =>
array (size=8)
'CodeClient' => string 'C016A' (length=5)
'Nom' => string 'PaulD' (length=16)
'FacEMail' => string '[email protected]' (length=26)
'DateCarteFidelite' => string '06/05/2011' (length=10)
'LastVente' => string '06/05/2011' (length=10)
'TotalPassage' => string '1' (length=1)
'TotalCA' => string '80,15' (length=5)
'TotalRemise' => string '0,00' (length=4)
1 =>
array (size=8)
'CodeClient' => string 'C0162' (length=5)
'Nom' => string 'ma-ma' (length=10)
'FacEMail' => string '[email protected]' (length=21)
'DateCarteFidelite' => string '04/05/2011' (length=10)
'LastVente' => string '19/05/2011' (length=10)
'TotalPassage' => string '1' (length=1)
'TotalCA' => string '31,20' (length=5)
'TotalRemise' => string '0,00' (length=4)
2 =>
array (size=8)
'CodeClient' => string 'C016F' (length=5)
'Nom' => string 'Pierre' (length=10)
'FacEMail' => string '[email protected]' (length=21)
'DateCarteFidelite' => string '14/05/2011' (length=10)
'LastVente' => string '14/05/2011' (length=10)
'TotalPassage' => string '1' (length=1)
'TotalCA' => string '164,00' (length=6)
'TotalRemise' => string '0,00' (length=4) foreach ($ListeClient as $key => $row) {
$TotalCA[$key] = $row['TotalCA'];
$TotalRemise[$key] = $row['TotalRemise'];
} puis array_multisort($TotalCA, SORT_NUMERIC, SORT_ASC, $TotalRemise, SORT_ASC, $ListeClient);
le probleme s'effectue sur les milliers puis sur les dizaines puis les centaines. Le résultat obtenu est : 1650 > 1880 > 20 > 135 > 283 > 450... Bref il trie pas dans le bon ordre. Je ne vois pas trop comment faire. Merci