function pc_u_length($a, $b) {
$a = strlen($a);
$b = strlen($b);
if ($a == $b) return 0;
if ($a > $b) return 1;
return -1;
}
function pc_map_length($a) {
return strlen($a);
}
$tests = array('one', 'two', 'three', 'four', 'five',
'six', 'seven', 'eight', 'nine', 'ten');
// faster for < 5 elements using pc_u_length()
usort($tests, 'pc_u_length');
// faster for >= 5 elements using pc_map_length()
$tests = pc_array_sort($tests, 'pc_map_length');