3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = array(array("data" => "abcd", "edit" => "1", "day" => "05", "month" => "04", "year" => "2013"), array("data" => "efgh", "edit" => "2", "day" => "07", "month" => "03", "year" => "2013")); usort($data, function ($a, $b) { $date1 = DateTime::createFromFormat("d/m/Y", $a["day"].'/'.$a["month"].'/'.$a["year"]); $date2 = DateTime::createFromFormat("d/m/Y", $b["day"].'/'.$b["month"].'/'.$b["year"]); return $date1->getTimestamp() - $date2->getTimestamp(); }); var_dump($data);
Output for 5.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> array(5) { ["data"]=> string(4) "efgh" ["edit"]=> string(1) "2" ["day"]=> string(2) "07" ["month"]=> string(2) "03" ["year"]=> string(4) "2013" } [1]=> array(5) { ["data"]=> string(4) "abcd" ["edit"]=> string(1) "1" ["day"]=> string(2) "05" ["month"]=> string(2) "04" ["year"]=> string(4) "2013" } }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/C3Cch on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/C3Cch on line 15
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/C3Cch on line 15
Process exited with code 255.