I have an array such as:
Array ( [0] => Array ( [id] => 2 [type] => comment [text] => hey [datetime] => 20
For 'd/m/Y' dates:
'd/m/Y'
usort($array, function ($a, $b, $i = 'datetime') { $t1 = strtotime(str_replace('/', '-', $a[$i])); $t2 = strtotime(str_replace('/', '-', $b[$i])); return $t1 > $t2; });
where $i is the array index
$i