English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
sort() function sorts the array
sort( $array [, $sort_flags] );
This function sorts the array. After this function is executed, the elements will be arranged from lowest to highest.
Number | Parameters and descriptions |
---|---|
1 | array(Required) It specifies an array. |
2 | sort_flags(optional) It specifies how to sort the array values. Possible values-
|
Returns TRUE on success, FALSE on failure.
<?php $input = array("d"=>"limão", "a"=>"laranja", "b"=>"banana"); sort($input); print_r($input); ?>Teste veja‹/›
Output result:
Array ( [0] => banana [1=> limão [2=> laranja )