I need to combine 2 arrays coming from data base (each one ordered by date descent) and echo a new one together by date descent. Studying php sort functions I got to this code:
//Function
function dateSort($a,$b){
$dateA = strtotime($a['data']);
$dateB = $b['payment_date'];//already unixtime
return ($dateA-$dateB);
}
// Merge the arrays
$h_pp_ps = array_merge($h_pp,$h_ps);
// Sort the array using the call back function
usort($h_pp_ps, 'dateSort');
//PRINT!!
print_r($h_pp_ps);
This will produce results from low date to high.... how to get it from high to low?