Associative array sorting
Posted: Wed Sep 16, 2009 1:16 pm
I just can't figure out how to do complex sorting with PHP. Lets say I have this associative array:
$ips['10.2.3.4']['total']=6
$ips['10.3.4.5']['total']=22
$ips['10.99.53.5']['total']=3
All I want to do is sort numerically by "total". Assume I can not simplify the structure of the array. Each IP entry has fields other than "total" which I'm not showing for simplicity. Thanks.
$ips['10.2.3.4']['total']=6
$ips['10.3.4.5']['total']=22
$ips['10.99.53.5']['total']=3
All I want to do is sort numerically by "total". Assume I can not simplify the structure of the array. Each IP entry has fields other than "total" which I'm not showing for simplicity. Thanks.