PHP » PYTHON |
login |
register |
about
|
array.sort() result = sorted(array) # does not change input array, requires Python 2.4+ sort(PHP 4, PHP 5) sort — Sort an array Description
bool sort
( array &$array
[, int $sort_flags= SORT_REGULAR
] )
This function sorts an array. Elements will be arranged from lowest to highest when this function has completed. Parameters
Return ValuesReturns TRUE on success or FALSE on failure. Changelog
Examples
Example #1 sort() example
<?php The above example will output: fruits[0] = apple fruits[1] = banana fruits[2] = lemon fruits[3] = orange
The fruits have been sorted in alphabetical order. Notes
Warning
Be careful when sorting arrays with mixed types values because sort() can produce unpredictable results. See Also
|
more
Recently updated
more
Most requested
more
Last requests
|