I have looked at the php documentation, tutorials online and none of them how usort is actually working. I have an example i was playing with below.
$data =
The function cmp itself doesn't do the sorting. It just tells usort if a value is smaller, equal or greater than another value. E.g. if $a = 5 and $b = 9 it will return 1 to indicate that the value in $b is greater than the one in $a.
cmp
usort
$a = 5
$b = 9
$b
$a
Sorting is done by usort.