3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function isMarketOpen($timestamp) { //>Wed 11:32:10 EST $timezone = new DateTimeZone('ET'); $nowDate = new DateTime((string) $timestamp, $timezone); $marketCloseTime = new DateTime('5PM', $timezone); $marketOpenTime = new DateTime('8AM', $timezone); echo $marketOpenTime->format('r'); echo "\n"; echo $nowDate->format('r'); return ($nowDate > $marketOpenTime && $nowDate < $marketCloseTime); } isMarketOpen('Wed 07:32:10 EST');
based on RgDD7
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (ET) in /in/5J4oj:5 Stack trace: #0 /in/5J4oj(5): DateTimeZone->__construct('ET') #1 /in/5J4oj(17): isMarketOpen('Wed 07:32:10 ES...') #2 {main} thrown in /in/5J4oj on line 5
Process exited with code 255.
Output for 5.2.0 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (ET)' in /in/5J4oj:5 Stack trace: #0 /in/5J4oj(5): DateTimeZone->__construct('ET') #1 /in/5J4oj(17): isMarketOpen('Wed 07:32:10 ES...') #2 {main} thrown in /in/5J4oj on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/5J4oj on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/5J4oj on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/5J4oj on line 5