Please help... I would like to sort the following array by the "make" AND the "model"... it currently sorts by "make" just fine.
//Function
function sortColumn($a, $b)
{
return strcmp($a["make"], $b["make"]);
}
//Array
$cars = array(
array('make' => 'Ford', 'model' => 'F250'),
array('make' => 'Honda', 'model' => 'Civic'),
array('make' => 'Honda', 'model' => 'Accord'),
array('make' => 'Ford', 'model' => 'F150'),
);
//Run usort
usort($cars, 'sortColumn');
//Display
foreach($cars as $a) {
echo $a["make"] . ' ' . $a["model"] . '<br>';
}
The results are:
Ford F250
Ford F150
Honda Civic
Honda Accord
I would like the "models" to be sorted also. Any ideas??