php - How can I sort an array from 2 fields? -
i have following format of array
[hometeam] => brazil [awayteam] => croatia
how can sort array based on home , away teams.
so brazil come first if home or away team.
do need array_multisort? i've given try, not getting right results.
any appreciated.
cheers
use usort
:
usort($myarray, function($a, $b) { return $a > $b; });
you need modify return
condition depending on how want sorted.
Comments
Post a Comment