3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dts = array(); $dts[] = new DateTime('2013-07-09 10:01:02 America/New_York'); $dts[] = new DateTime('10:01:02'); $dts[] = new DateTime('10:01:02 America/New_York'); $dts[] = new DateTime('10:01:02 Australia/Sydney'); foreach ( $dts as $dt ) echo $dt->format('c - e').PHP_EOL;
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
2013-07-09T10:01:02-04:00 - America/New_York 2013-07-09T10:01:02+02:00 - Europe/Amsterdam 2013-07-09T10:01:02-04:00 - America/New_York 2013-07-09T10:01:02+10:00 - Australia/Sydney
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/D3VSh on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/D3VSh on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/D3VSh on line 3