How the php array_multisort function works

The array_multisort function in php allows you to sort several arrays at the same time. How it works is:

  1. Sort first array by key value (depending on arguments)
  2. If there are any identical keys in the first array, sort these by the keys in the second array (assuming it is specified)
  3. etc.

The documentation for this isn’t particularly clear.

Published by

Jamie Scott

IT Administrator at the Institute for Gravitational Research, University of Glasgow