3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('UTC'); // fill in the blank $timezones = array( 'Sydney' => 'Australia/Sydney', 'Melbourne' => 'Australia/Melbourne', 'New York' => 'America/New_York' ); foreach ($timezones as $name => $timezone) { $localTime = new DateTime('now', new DateTimeZone($timezone)); echo "$name: ", $localTime->format('h:ia'); }
Output for 5.6.28, 7.0.12 - 7.1.0
Sydney: 12:25amMelbourne: 12:25amNew York: 08:25am
Output for 7.0.6
Sydney: 01:29pmMelbourne: 01:29pmNew York: 11:29pm
Output for 5.4.38 - 5.4.45, 5.5.22 - 5.5.34, 5.6.6 - 5.6.20, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.5
Sydney: 09:39amMelbourne: 09:39amNew York: 07:39pm
Output for 5.6.21
Sydney: 08:33amMelbourne: 08:33amNew York: 06:33pm
Output for 5.2.0 - 5.4.37, 5.5.0 - 5.5.21, 5.6.0 - 5.6.5
Sydney: 09:40amMelbourne: 09:40amNew York: 07:40pm
Output for 5.5.35
Sydney: 12:21pmMelbourne: 12:21pmNew York: 10:21pm
Output for 5.1.0 - 5.1.6
<br /> <b>Fatal error</b>: Class 'DateTime' not found in <b>/in/gjjtH</b> on line <b>12</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<br /> <b>Fatal error</b>: Call to undefined function date_default_timezone_set() in <b>/in/gjjtH</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: date_default_timezone_set() in <b>/in/gjjtH</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: date_default_timezone_set() in <b>/in/gjjtH</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: date_default_timezone_set() in <b>/in/gjjtH</b> on line <b>3</b><br />