3v4l.org

run code in 300+ PHP versions simultaneously
<?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');
Output for git.master, git.master_jit
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 rfc.property-hooks
Fatal error: Uncaught DateInvalidTimeZoneException: 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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.57 ms | 401 KiB | 8 Q