array sorting
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
array sorting
i need to sort an array by the amount of characters in the value. how would i go about doing that
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
entirely untested
Code: Select all
$temp = array_map('strlen',$array);
asort($temp);
$new = array();
foreach($temp as $k => $blah)
{
$new[$k] = $array[$k];
}