1.

Which function should we use to sort the array in natural order?(a) dsort()(b) casesort()(c) natcasesort()(d) naturalsort()This question was posed to me in exam.Question is taken from Arrays topic in portion Arrays and Functions of PHP

Answer»

The correct option is (C) natcasesort()

The explanation is: 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.



Discussion

No Comment Found

Related InterviewSolutions