<?php
function sortFunction( $a, $b ) {
return strtotime($a["date"]) - strtotime($b["date"]);
}
$data=[{"date":"2013-09-01 00:00:02","content":"1"},
{"date":"2013-09-01 00:00:09","content":"5"},
{"date":"2013-09-01 00:00:01","content":"3"}];
usort($data, "sortFunction");
var_dump($data);
- Output for 5.4.0 - 5.4.19
- Parse error: syntax error, unexpected '{', expecting ']' in /in/aYMJA on line 7
Process exited with code 255. - Output for 5.3.4 - 5.3.27
- Parse error: syntax error, unexpected '[' in /in/aYMJA on line 7
Process exited with code 255.
preferences:
174.11 ms | 1399 KiB | 51 Q