3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Based on the following business hours: * (Note : I setup the hours for each day if they carry-over) * everyday is open from 09:00 AM - 12:00 AM * Sun/Sat open extra from 12:00 AM - 01:00 AM */ $storeSchedule = [ 'Sun' => ['12:00 AM' => '01:00 AM', '09:00 AM' => '12:00 AM'], 'Mon' => ['09:00 AM' => '12:00 AM'], 'Tue' => ['09:00 AM' => '12:00 AM'], 'Wed' => ['09:00 AM' => '12:00 AM'], 'Thu' => ['09:00 AM' => '12:00 AM'], 'Fri' => ['09:00 AM' => '12:00 AM'], 'Sat' => ['12:00 AM' => '01:00 AM', '09:00 AM' => '12:00 AM'] ]; // current OR user supplied UNIX timestamp $timestamp = time(); // default status $status = 'closed'; // get current time object $currentTime = (new DateTime())->setTimestamp($timestamp); echo $currentTime; // loop through time ranges for current day foreach ($storeSchedule[date('D', $timestamp)] as $startTime => $endTime) { // create time objects from start/end times $startTime = DateTime::createFromFormat('h:i A', $startTime); $endTime = DateTime::createFromFormat('h:i A', $endTime); // check if current time is within a range if (($startTime < $currentTime) && ($currentTime < $endTime)) { $status = 'open'; break; } } echo "We are currently: $status";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0070.00716.80
7.3.00.0060.00316.91
7.2.130.0040.00716.82
7.2.120.0110.00017.02
7.2.110.0060.00917.15
7.2.100.0090.00617.09
7.2.90.0040.01116.69
7.2.80.0060.00616.79
7.2.70.0040.01117.08
7.2.60.0090.00317.05
7.2.50.0100.00317.04
7.2.40.0000.00916.92
7.2.30.0090.00616.82
7.2.20.0070.00416.99
7.2.10.0000.01517.14
7.2.00.0100.00317.07
7.1.250.0070.00715.88
7.1.240.0060.00615.89
7.1.230.0030.00716.03
7.1.220.0030.01015.89
7.1.210.0030.00715.91
7.1.200.0150.00015.82
7.1.190.0060.00315.88
7.1.180.0040.00415.78
7.1.170.0030.00615.74
7.1.160.0060.00615.64
7.1.150.0000.00915.96
7.1.140.0080.00816.02
7.1.130.0080.00415.81
7.1.120.0100.00315.82
7.1.110.0070.00715.75
7.1.100.0110.00416.02
7.1.90.0070.00415.85
7.1.80.0000.00915.97
7.1.70.0090.00916.11
7.1.60.0070.00715.78
7.1.50.0090.00616.06
7.1.40.0030.00915.85
7.1.30.0040.00416.09
7.1.20.0090.00315.57
7.1.10.0050.00515.82
7.1.00.0070.00715.81
7.0.330.0030.00715.55
7.0.320.0100.00315.58
7.0.310.0070.00715.55
7.0.300.0030.00915.59
7.0.290.0000.01215.32
7.0.280.0030.00715.36
7.0.270.0030.00915.69
7.0.260.0060.00315.66
7.0.250.0030.00915.45
7.0.240.0030.01015.70
7.0.230.0030.01015.80
7.0.220.0080.00815.63
7.0.210.0070.00715.73
7.0.200.0040.01115.66
7.0.190.0030.00715.73
7.0.180.0000.00915.65
7.0.170.0100.00315.68
7.0.160.0000.00915.36
7.0.150.0000.00915.62
7.0.140.0040.01215.70
7.0.130.0130.00315.40
7.0.120.0030.01315.58
7.0.110.0030.01015.68
7.0.100.0060.00315.58
7.0.90.0060.00915.71
7.0.80.0000.01515.64
7.0.70.0060.00615.46
7.0.60.0040.01115.38
7.0.50.0030.00615.31
7.0.40.0000.01013.69
7.0.30.0130.00313.27
7.0.20.0030.00913.34
7.0.10.0160.00013.62
7.0.00.0000.01213.42
5.6.380.0060.00614.81
5.6.370.0070.00714.50
5.6.360.0140.00014.51
5.6.350.0080.00414.13
5.6.340.0040.01114.62
5.6.330.0100.00314.55
5.6.320.0040.00714.64
5.6.310.0030.00814.73
5.6.300.0030.01214.39
5.6.290.0030.00914.48
5.6.280.0030.00614.43
5.6.270.0030.01014.38
5.6.260.0130.00314.40
5.6.250.0040.01214.36
5.6.240.0030.00914.58
5.6.230.0040.01114.43
5.6.220.0000.01314.26
5.6.210.0070.00714.11
5.6.200.0000.01514.20
5.6.190.0000.01314.55
5.6.180.0110.00414.67
5.6.170.0060.00614.58
5.6.160.0030.00614.72
5.6.150.0120.00314.27
5.6.140.0060.00814.52
5.6.130.0120.00514.41
5.6.120.0050.00814.36
5.6.110.0030.01014.24
5.6.100.0070.00914.44
5.6.90.0070.00714.29
5.6.80.0060.00814.21
5.6.70.0020.01214.33
5.6.60.0040.01014.35
5.6.50.0100.00314.41
5.6.40.0030.01014.13
5.6.30.0060.00914.24
5.6.20.0120.00314.39
5.6.10.0090.00514.26
5.6.00.0090.00514.32
5.5.380.0040.00711.43
5.5.370.0000.01311.43
5.5.360.0040.00411.43
5.5.350.0070.00411.43
5.5.340.0000.00611.43
5.5.330.0030.00711.43
5.5.320.0060.00011.43
5.5.310.0000.00611.43
5.5.300.0030.00511.37
5.5.290.0060.00511.31
5.5.280.0060.00411.36
5.5.270.0060.00511.27
5.5.260.0010.00811.31
5.5.250.0100.00011.29
5.5.240.0050.00511.33
5.5.230.0020.00711.19
5.5.220.0050.00511.15
5.5.210.0060.00511.32
5.5.200.0060.00311.25
5.5.190.0050.00711.26
5.5.180.0070.00411.20
5.5.170.0060.00612.82
5.5.160.0030.00711.26
5.5.150.0030.00811.22
5.5.140.0020.00711.33
5.5.130.0040.00811.30
5.5.120.0060.00311.28
5.5.110.0000.01111.36
5.5.100.0030.00611.36
5.5.90.0040.00611.10
5.5.80.0070.00311.31
5.5.70.0040.00711.25
5.5.60.0020.00811.33
5.5.50.0040.00411.38
5.5.40.0080.00311.30
5.5.30.0030.00611.20
5.5.20.0030.00911.18
5.5.10.0050.00711.32
5.5.00.0020.01011.29
5.4.450.0080.00011.31
5.4.440.0060.00411.25
5.4.430.0050.00511.29
5.4.420.0070.00411.14
5.4.410.0070.00411.24
5.4.400.0030.00611.09
5.4.390.0040.00511.33
5.4.380.0060.00511.30
5.4.370.0060.00311.16
5.4.360.0060.00611.20
5.4.350.0060.00411.21
5.4.340.0030.00511.23
5.4.330.0050.00411.34
5.4.320.0020.00611.13
5.4.310.0050.00411.14
5.4.300.0060.00511.17
5.4.290.0030.00711.25
5.4.280.0080.00311.25
5.4.270.0040.00411.19
5.4.260.0100.00111.22
5.4.250.0040.00911.25
5.4.240.0070.00511.22
5.4.230.0020.00711.25
5.4.220.0070.00411.21
5.4.210.0030.00911.22
5.4.200.0090.00111.25
5.4.190.0020.00811.12
5.4.180.0040.00611.23
5.4.170.0050.00411.29
5.4.160.0030.00811.17
5.4.150.0020.00911.20
5.4.140.0060.00511.27
5.4.130.0030.00611.31
5.4.120.0080.00011.22
5.4.110.0080.00511.27
5.4.100.0030.00611.35
5.4.90.0030.00711.27
5.4.80.0030.00911.24
5.4.70.0080.00111.25
5.4.60.0050.00611.30
5.4.50.0070.00311.08
5.4.40.0040.00411.26
5.4.30.0030.00811.26
5.4.20.0060.00711.27
5.4.10.0040.00511.24
5.4.00.0020.00711.30

preferences:
32.37 ms | 400 KiB | 5 Q