英[sɔ:t] 美[sɔ:rt]
n.Classification, category; quality, nature; method; a group
vt.& vi.Classification; rectification, arrangement ; suitable for
vt. to select; to classify; to put in order
vi. to classify; to communicate; to coordinate
Third person singular: sorts Plural: sorts Present participle: sorting past tense: sorted past participle: sorted
php natcasesort() function syntax
Function:Use the "natural sorting" algorithm to sort the array. Key values retain their original key names.
Syntax:natcasesort(array)
Parameters:
Parameter | Description |
array | Required. Specifies the array to be sorted. |
Explanation:In the natural sorting algorithm, the number 2 is less than the number 10. In computer sorting algorithms, 10 is less than 2 because the first number in "10" is less than 2. This function is not case sensitive. The function returns TRUE if successful and FALSE if failed.
php natcasesort() function example
Output:
Array ( [2] => string01 [5] => string02 [0] => string1 [3] => string2 [1] => string10 [4] => string20 )