i am try to sort array having some problms tell me the right way.
- 6 years ago
My suggestion would be:
function cmp($a, $b)
{
return strcmp($a->display_name, $b->display_name);
}
usort($blogusers, "cmp");
foreach ($blogusers as $bloguser)
{
...
- 6 years ago
//define a comparison function
function sortArr($a, $b) {
if ($a['status'] == $b['status']) {
return 0;
}
return ($a['status'] < $b['status']) ? -1 : 1;
}
usort($array, "sortArr");
That should do what you want, you can alter the comparison function to sort on whatever key you want.
Hot Questions