Which function should we use to sort the array in natural order?

Which function should we use to sort the array in natural order?
A. dsort()
B. casesort()
C. natcasesort()
D. naturalsort()
 
Answer: c
Explanation: The function natcasesort() in PHP sorts an array by using a “natural order” algorithm. All the values keep their original keys. Eg: In a natural algorithm, as the number 2 is less than the number 10. But in computer sorting, 10 is less than 2, because the first number in “10” is less than 2. The function is case-insensitive.
 

Tìm kiếm

Back
Top