你需要这样做。
<?php
$inventory = array(
array(
"salesID"=>7,
"creditID"=>9,
'amount'=>80400.00,
'due_date'=>strtotime(2018-12-12),
'status' => 'no',
'given_date' => 'no',
'av_class' => 'no',
'name' => 'no',
'contact' => 0
),
array(
"salesID"=>3,
"creditID"=>8,
'amount'=>500.00,
'due_date'=>strtotime(2019-06-25),
'status' => 'yes',
'given_date' => '2018-09-30',
'av_class' => 'table-success',
'name' => 'Zayan',
'contact' => '0765894520'
)
);
$date = array();
foreach ($inventory as $key => $row)
{
$date[$key] = $row['due_date'];
}
array_multisort($date, SORT_DESC, $inventory);
echo '<pre>';
print_r($inventory);
?>
这将按照截止日期降序排列数组。但您需要在数组中使用带有日期的'strotime()'函数。