...
Two special comparison operators are useful with the sort() operator: <=>
and cmp
. These operators return -1 if the first operand is less than the second, 0, if they're equal, and 1 if the first operand is greater than the second.The <=>
operator is used with numbers and cmp
is used with strings.
...