Ver originalfunction cmp($a, $b) { if (strlen($a) == strlen($b)) { return 0; } return (strlen($a) > strlen($b)) ? -1 : 1;} $data = array('aaaaa', 'bbbb', 'cccccc', 'dd', 'e'); usort($data, "cmp"); foreach ($data as $cadena) { echo "$cadena <br />";}