0
J'ai un tableau qui contient un tableau comme le s ['nom'] s ['age'] Je ne sais pas exactement comment représenter la structure [ou},tableau de tableau php ordre par 2 champs chaîne et nombre
tab {
s { ['name']
['age']
}
}
il mon code, il est fonction cmp ($ a, $ b) { strcmp de retour ($ a, $ b [ 'nom'] [ 'name']); }
usort($result, "cmp");
foreach($result as $s) {
foreach($s as $t) {
DisplayError("antoine 20")
DisplayError("antoine 88")
DisplayError("antoine 19")
}
}
Je voudrais trier d'abord par nom, puis l'âge
Je recherche depuis longtemps, mais difficile
J'ai trouvé un truc que j'ai fait un nouveau tableau ['nomAge'] et j'utilise la fonction cmpNameAge ($ a, $ b) { return strcmp ($ a ['nomAge'], $ b ['nomAge']); } – aez