note 109505 deleted from function.sort by googleguy
| From: | googleguy@php.net | Date: | Tue, 24 Jul 2012 04:00:06 +0000 |
| Subject: | note 109505 deleted from function.sort by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189380@lists.php.net to get a copy of this message | ||
Note Submitter: manja@mineka/com
----
@holdoffhunger at gmail dot com
There is a lot easier way to accomplish same thing:
//Released under WTFPL v2
//http://en.wikipedia.org/wiki/WTFPL
$array_of_data =
array("hello","php","is","awesome","1","1234","12","9");
$elems = count($array_of_data);
for ($i=0;$i<$elems-1;$i++)
{
for ($j=$i+1;$j<$elems;$j++)
{
if (strlen($array_of_data[$i]) < strlen($array_of_data[$j]))
{
$tmp = $array_of_data[$i];
$array_of_data[$i] = $array_of_data[$j];
$array_of_data[$j] = $tmp;
}
}
}