RE: Array sort question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
That's not entirely fair. I would have said his usort() suggestion was
a better pointer than a link to count() - which gives no hint as to
how to sort the list, which is after all what the OP's trying to do.

ObSuggestion:

function byLength($a, $b)
{
   return sizeof($a) - sizeof($b);
}

usort($rgArray, 'byLength');

Well said, after all there is more than one way to skin a cat.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux