<?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[$key]);
$t2 = strtotime($b[$key]);
return $t1 - $t2;
}
usort($array, 'date_compare'));
var_dump($array);
- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.26
- Parse error: syntax error, unexpected ')' in /in/nPta1 on line 12
Process exited with code 255.
preferences:
189.43 ms | 1395 KiB | 63 Q