3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = new DateTime("2014-09-24"); var_dump($a); echo $a->format('m-d-Y'); $a = array( ["date"]=> "2014-09-24 00:00:00.000000", ["timezone_type"]=>3, ["timezone"]=>"Europe/Amsterdam" ); echo "\n",$a["date"]; ?>
based on ckoPn
Output for 5.4.30 - 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-09-24 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 09-24-2014 Warning: Illegal offset type in /in/8552X on line 7 Warning: Illegal offset type in /in/8552X on line 8 Warning: Illegal offset type in /in/8552X on line 10 Notice: Undefined index: date in /in/8552X on line 12
Output for 5.4.0 - 5.4.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-09-24 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 09-24-2014 Warning: Illegal offset type in /in/8552X on line 7 Warning: Illegal offset type in /in/8552X on line 8 Warning: Illegal offset type in /in/8552X on line 10 Notice: Undefined index: date in /in/8552X on line 12
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/8552X on line 7
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 '[', expecting ')' in /in/8552X on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/8552X on line 7
Process exited with code 255.