The items of an array can be sorted by various methods.

  • sort() - it sort arrays in ascending order
  • rsort() - it sort arrays in descending order
  • asort() - it sorts associative arrays in ascending order, according to the value
  • ksort() - it sort associative arrays in ascending order, according to the key
  • arsort() - it sorts associative arrays in descending order, according to the value
  • krsort() - it sorts associative arrays in descending order, according to the key
BY Best Interview Question ON 09 Mar 2020