Multiple choice technology web technology

Which is the function used to order backwards an associative array maintaining associations?

  1. asort($array)
  2. ksort($array)
  3. krsort($array)
  4. usort($array)
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

krsort() sorts an associative array by key in reverse order (descending) while maintaining key-value associations. ksort() sorts ascending by keys. asort() sorts ascending by values. usort() sorts by values using a custom comparison function and doesn't maintain key associations.