Would anybody have any suggestions on how to sort an array elements by the strlen of the values? For example:
Turn this array:
PHP Code:
$array = array( 'world!', 'hello', 'hello world!' );
To sort like this (length descending):
Code:
Array (
[0] => hello world!
[1] => world!
[2] => hello
)
I know you can do a usort to sort by an external user defined function, but I'm unsure how that works really.
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|