You can sort an Array by value with following function:-
Have Fun!
function sortByValue (&$array, $key)
{
$sorter=array();
$return=array();
reset($array);
foreach ($array as $ii => $va)
{
$sorter[$ii] = $va[$key];
}
asort($sorter);
foreach ($sorter as $iii => $va)
{
$return[$iii] = $array[$iii];
}
$array=$return;
return $array;
}
Have Fun!
No comments:
Post a Comment