7.2 Tableaux
7 Index des fonctions
Manuel PHP
. Introduction . Pré-requis . Installation . Configuration à l'exécution . Types de ressources . Constantes prédefinies . Voir aussi . array_change_key_case . array_chunk . array_combine . array_count_values . array_diff_assoc . array_diff . array_fill . array_filter . array_flip . array_intersect_assoc . array_intersect . array_key_exists . array_keys . array_map . array_merge_recursive . array_merge . array_multisort . array_pad . array_pop . array_push . array_rand . array_reduce . array_reverse . array_search . array_shift . array_slice . array_splice . array_sum . array_unique . array_unshift . array_values . array_walk . array . arsort . asort . compact . count . current . each . end . extract . in_array . key . krsort . ksort . list . natcasesort . natsort . next . pos . prev . range . reset ->rsort . shuffle . sizeof . sort . uasort . uksort . usort
|
7.2.61 rsort()Trie en ordre inverse[ Exemples avec rsort ] PHP 3, PHP 4
void
rsort (
array
array
,
int
sort_flags
)
rsort
effectue un tri en ordre décroissant (du plus grand au
plus petit).
Exemple avec rsort |
<?php $fruits = array("papaye","orange","banane","ananas"); rsort($fruits); for (reset($fruits); list($key,$value) = each($fruits); ) { echo "fruits[$key] = ", $value, "\n"; } ?>
|
Cet exemple va afficher:
fruits[0] = papaye
fruits[1] = orange
fruits[2] = banane
fruits[3] = ananas
Les fruits ont été classés dans l'ordre alphabétique
inverse.
Vous pouvez modifier le comportement de cette fonction en utilisant
le paramètre optionnel
sort_flags
. Pour plus
de détails, voyez le manuel pour la fonction
sort
.
Voir aussi
arsort
,
asort
,
ksort
,
sort
et
usort
.
|