par
Ryle » 13 août 2008, 14:05
Tu peux faire un print_r() de ton tableau ? J'ai comme l'impression que tu colles à la suite des pseudo, des adresses, et je ne sais quoi encore ?
Dans tous les cas, si ton tableau est un tableau à une dimension, un simple appel à la fonction sort() aura pour effet de le trier par ordre alphabétique. Si ton tableau est bien constitué ainsi :
$tab = array ('Albert', 'Bob', 'Cedric', 'Albert2', 'Bob 2', 'Cedric2', ...) ;
print_r($tab); // => array ('Albert', 'Bob', 'Cedric', 'Albert2', 'Bob 2', 'Cedric2', ...) ;
sort($tab); // va trier le tableau
print_r($tab); // => array ('Albert', 'Albert2', 'Bob', 'Bob 2', 'Cedric', 'Cedric2', ...) ;
S'il s'agit d'un tableau à plusieurs dimensions, il faut te pencher du côté de array_multisort()

Tu peux faire un print_r() de ton tableau ? J'ai comme l'impression que tu colles à la suite des pseudo, des adresses, et je ne sais quoi encore ?
Dans tous les cas, si ton tableau est un tableau à une dimension, un simple appel à la fonction sort() aura pour effet de le trier par ordre alphabétique. Si ton tableau est bien constitué ainsi :
[php]$tab = array ('Albert', 'Bob', 'Cedric', 'Albert2', 'Bob 2', 'Cedric2', ...) ;
print_r($tab); // => array ('Albert', 'Bob', 'Cedric', 'Albert2', 'Bob 2', 'Cedric2', ...) ;
sort($tab); // va trier le tableau
print_r($tab); // => array ('Albert', 'Albert2', 'Bob', 'Bob 2', 'Cedric', 'Cedric2', ...) ;[/php]
S'il s'agit d'un tableau à plusieurs dimensions, il faut te pencher du côté de array_multisort() :)