unless you specify the second argument, "regular" comparisons will be used. I quote from the page on comparison operators:
"If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically."
What this means is that "10" < "1a", and "1a" < "2", but "10" > "2". In other words, regular PHP string comparisons are not transitive.
This implies that the output of sort() can in rare cases depend on the order of the input array:
<?php
function echo_sorted($a)
{
echo "{$a[0]} {$a[1]} {$a[2]}";
sort($a);
echo " => {$a[0]} {$a[1]} {$a[2]}\n";
}
echo_sorted(array( "10", "1a", "2")); echo_sorted(array( "10", "2", "1a")); echo_sorted(array( "1a", "10", "2")); echo_sorted(array( "1a", "2", "10")); echo_sorted(array( "2", "10", "1a")); echo_sorted(array( "2", "1a", "10")); ?>