3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(array('date'=>'2014-12-01', 'price'=>'123.00'), array('date'=>'2013-12-01', 'price'=>'123.00'), array('date'=>'2014-02-01', 'price'=>'123.00'), array('date'=>'2014-03-01', 'price'=>'123.00')); var_dump($array); function date_compare($a, $b) { $t1 = strtotime($a['date']); $t2 = strtotime($b['date']); return $t1 - $t2; } usort($array, 'date_compare'); var_dump($array); function dateCompare($a, $b) { $t1 = strtotime($a); $t2 = strtotime($b); return round(($t1 - $t2)/86400); } var_dump(dateCompare(date('Y-m-d'), '2014-03-06'));

preferences:
43.22 ms | 402 KiB | 5 Q