I want to sort it so that the top level array items (the ones with numeric keys) are ordered alphabetically on the content of the nested item with the key “media.”
I have looked at the function array_multisort but can’t figure out how to set it up to do what I want.
Please don’t do this! The function being used for the sorting should return zero if the items are considered equal, positive if a is to be considered greater than b and negative if a is to be considered less than b. Anthony’s function returns a boolean (as a number, that’s either 0 or 1) which only gets the return value right in two of the three possible comparison outcomes.