3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function isMarketOpen($timestamp) { //>Wed 11:32:10 EST $timezone = new DateTimeZone('America/New_York'); $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 5J4oj
Output for 5.2.0 - 5.4.32, 5.6.28, 7.0.14 - 7.1.0
Wed, 01 Oct 2014 08:00:00 -0400 Wed, 01 Oct 2014 07:32:10 -0500
Output for 7.0.6
Tue, 03 May 2016 08:00:00 -0400 Wed, 04 May 2016 07:32:10 -0500
Output for 5.6.14, 7.0.5
Sat, 02 Apr 2016 08:00:00 -0400 Wed, 06 Apr 2016 07:32:10 -0500
Output for 7.0.4
Thu, 10 Mar 2016 08:00:00 -0500 Wed, 16 Mar 2016 07:32:10 -0500
Output for 7.0.3
Fri, 18 Mar 2016 08:00:00 -0400 Wed, 23 Mar 2016 07:32:10 -0500
Output for 7.0.2
Tue, 22 Mar 2016 08:00:00 -0400 Wed, 23 Mar 2016 07:32:10 -0500
Output for 7.0.1
Wed, 23 Mar 2016 08:00:00 -0400 Wed, 23 Mar 2016 07:32:10 -0500
Output for 7.0.0
Sun, 27 Mar 2016 08:00:00 -0400 Wed, 30 Mar 2016 07:32:10 -0500
Output for hhvm-3.12.0
Sat, 12 Mar 2016 08:00:00 -0500 Wed, 16 Mar 2016 07:32:10 -0500
Output for hhvm-3.10.0
Wed, 30 Mar 2016 08:00:00 -0400 Wed, 30 Mar 2016 07:32:10 -0500
Output for 5.6.21
Mon, 02 May 2016 08:00:00 -0400 Wed, 04 May 2016 07:32:10 -0500
Output for 5.6.20
Sat, 09 Apr 2016 08:00:00 -0400 Wed, 13 Apr 2016 07:32:10 -0500
Output for 5.6.19
Mon, 07 Mar 2016 08:00:00 -0500 Wed, 09 Mar 2016 07:32:10 -0500
Output for 5.6.18
Tue, 15 Mar 2016 08:00:00 -0400 Wed, 16 Mar 2016 07:32:10 -0500
Output for 5.6.17
Sat, 19 Mar 2016 08:00:00 -0400 Wed, 23 Mar 2016 07:32:10 -0500
Output for 5.6.16
Mon, 28 Mar 2016 08:00:00 -0400 Wed, 30 Mar 2016 07:32:10 -0500
Output for 5.6.15
Tue, 29 Mar 2016 08:00:00 -0400 Wed, 30 Mar 2016 07:32:10 -0500
Output for 5.6.13
Fri, 15 Apr 2016 08:00:00 -0400 Wed, 20 Apr 2016 07:32:10 -0500
Output for 5.6.12
Tue, 19 Apr 2016 08:00:00 -0400 Wed, 20 Apr 2016 07:32:10 -0500
Output for 5.6.11
Sat, 23 Apr 2016 08:00:00 -0400 Wed, 27 Apr 2016 07:32:10 -0500
Output for 5.6.10
Mon, 25 Apr 2016 08:00:00 -0400 Wed, 27 Apr 2016 07:32:10 -0500
Output for 5.6.9
Wed, 27 Apr 2016 08:00:00 -0400 Wed, 27 Apr 2016 07:32:10 -0500
Output for 5.6.8
Fri, 29 Apr 2016 08:00:00 -0400 Wed, 04 May 2016 07:32:10 -0500
Output for 5.5.35
Sun, 22 May 2016 08:00:00 -0400 Wed, 25 May 2016 07:32:10 -0500
Output for 5.5.34
Mon, 11 Apr 2016 08:00:00 -0400 Wed, 13 Apr 2016 07:32:10 -0500
Output for 5.5.33
Tue, 08 Mar 2016 08:00:00 -0500 Wed, 09 Mar 2016 07:32:10 -0500
Output for 5.5.32
Thu, 17 Mar 2016 08:00:00 -0400 Wed, 23 Mar 2016 07:32:10 -0500
Output for 5.5.31
Sun, 20 Mar 2016 08:00:00 -0400 Wed, 23 Mar 2016 07:32:10 -0500
Output for 5.5.30
Fri, 01 Apr 2016 08:00:00 -0400 Wed, 06 Apr 2016 07:32:10 -0500
Output for 5.5.29
Sat, 16 Apr 2016 08:00:00 -0400 Wed, 20 Apr 2016 07:32:10 -0500
Output for 5.5.28
Thu, 21 Apr 2016 08:00:00 -0400 Wed, 27 Apr 2016 07:32:10 -0500
Output for 5.5.27
Fri, 22 Apr 2016 08:00:00 -0400 Wed, 27 Apr 2016 07:32:10 -0500
Output for 5.5.26
Tue, 26 Apr 2016 08:00:00 -0400 Wed, 27 Apr 2016 07:32:10 -0500
Output for 5.5.25
Thu, 28 Apr 2016 08:00:00 -0400 Wed, 04 May 2016 07:32:10 -0500
Output for 5.5.24
Mon, 23 May 2016 08:00:00 -0400 Wed, 25 May 2016 07:32:10 -0500
Output for 5.4.45
Fri, 18 Sep 2015 08:00:00 -0400 Wed, 23 Sep 2015 07:32:10 -0500
Output for 5.4.39 - 5.4.44
Sat, 22 Aug 2015 08:00:00 -0400 Wed, 26 Aug 2015 07:32:10 -0500
Output for 5.4.34 - 5.4.38
Sun, 15 Mar 2015 08:00:00 -0400 Wed, 18 Mar 2015 07:32:10 -0500
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/iRSLt 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/iRSLt 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/iRSLt on line 5