Hi, Wednesday, December 22, 2004, 7:18:52 AM, you wrote: RPJ> Any idea how to sort an array by string length? RPJ> Russ Jones With a user defined sorting function something like this <?php function cmp($a, $b){ $x = strlen($a); $y = strlen($b); if ($x == $y) { return 0; } return ($x < $y) ? -1 : 1; } $array = array('Longest string','short','longer'); usort($array,'cmp'); ?> -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php