Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 849 Bytes

0396.md

File metadata and controls

15 lines (12 loc) · 849 Bytes

When defining a custom sorting callback for functions such as usort(), uksort() or uasort(), you must return 0 if two elements are considered equal. Which of the following statements best describes how PHP treats equal elements during sorting?

  • A) The order is undefined, meaning you cannot guarantee which element appears first in the sorted array
  • B) The element which was first in the unsorted array will be first in the sorted array
  • C) PHP randomly sorts equal elements to decide their order in the sorted array
  • D) PHP automatically sorts equal elements using the same algorithm as sort() to decide their order in the sorted array
Answer

Answer: A