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'], ]; // current OR user supplied UNIX timestamp $timestamp = time(); // default status $status = 'closed'; // get current time object $currentTime = (new DateTime())->setTimestamp($timestamp); // 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 currentlyd: $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.4.10.0070.01015.28
7.4.00.0040.01115.10
7.3.130.0000.01814.95
7.3.120.0120.00615.09
7.3.110.0030.01214.98
7.3.100.0030.01015.30
7.3.90.0050.00515.07
7.3.80.0070.00314.77
7.3.70.0070.00715.10
7.3.60.0070.00715.01
7.3.50.0100.00615.03
7.3.40.0100.00315.03
7.3.30.0060.00614.94
7.3.20.0060.00716.75
7.3.10.0020.01016.93
7.3.00.0060.00716.90
7.2.260.0070.01015.24
7.2.250.0040.01415.29
7.2.240.0070.00715.29
7.2.230.0000.01814.99
7.2.220.0100.00714.99
7.2.210.0030.01015.47
7.2.200.0090.00315.24
7.2.190.0090.00615.39
7.2.180.0000.01115.23
7.2.170.0090.00615.11
7.2.160.0030.01315.12
7.2.150.0030.01417.21
7.2.140.0060.00617.13
7.2.130.0050.00816.92
7.2.120.0040.00917.10
7.2.110.0030.00917.11
7.2.100.0060.00516.90
7.2.90.0050.01117.06
7.2.80.0080.00716.96
7.2.70.0070.00617.16
7.2.60.0070.00817.10
7.2.50.0030.00817.26
7.2.40.0050.00917.15
7.2.30.0090.00516.99
7.2.20.0080.00816.97
7.2.10.0050.01017.05
7.2.00.0050.00717.16
7.1.330.0060.00615.76
7.1.320.0130.00315.78
7.1.310.0110.00416.05
7.1.300.0070.00715.85
7.1.290.0060.01016.03
7.1.280.0060.00615.98
7.1.270.0080.00415.81
7.1.260.0100.00315.97
7.1.250.0080.00315.88
7.1.240.0110.00015.93
7.1.230.0040.00816.05
7.1.220.0080.00415.86
7.1.210.0060.00916.07
7.1.200.0080.00515.95
7.1.190.0090.00015.89
7.1.180.0040.00716.02
7.1.170.0030.01016.01
7.1.160.0080.00315.86
7.1.150.0040.00716.13
7.1.140.0120.00615.98
7.1.130.0090.00315.90
7.1.120.0060.00915.93
7.1.110.0090.00615.96
7.1.100.0030.01015.81
7.1.90.0040.00415.80
7.1.80.0120.00016.04
7.1.70.0030.00616.58
7.1.60.0110.01017.93
7.1.50.0080.00916.65
7.1.40.0030.00616.12
7.1.30.0030.01016.03
7.1.20.0040.00416.06
7.1.10.0040.01116.06
7.1.00.0020.04319.26
7.0.330.0000.01215.57
7.0.320.0030.01015.59
7.0.310.0030.00715.36
7.0.300.0080.00415.44
7.0.290.0040.00815.59
7.0.280.0030.01015.62
7.0.270.0000.01215.75
7.0.260.0030.00915.74
7.0.250.0040.01115.40
7.0.240.0090.00615.37
7.0.230.0030.00615.74
7.0.220.0000.01115.59
7.0.210.0040.00815.55
7.0.200.0070.00716.32
7.0.190.0080.00415.66
7.0.180.0120.00015.70
7.0.170.0100.00315.73
7.0.160.0150.00015.53
7.0.150.0060.00915.41
7.0.140.0020.04118.80
7.0.130.0040.01115.55
7.0.120.0070.00315.37
7.0.110.0030.00615.69
7.0.100.0070.00715.77
7.0.90.0140.03317.68
7.0.80.0200.04017.69
7.0.70.0030.04717.77
7.0.60.0070.02417.80
7.0.50.0050.03117.94
7.0.40.0050.04216.89
7.0.30.0100.04116.93
7.0.20.0030.02916.95
7.0.10.0050.02716.78
7.0.00.0070.03316.92
5.6.400.0030.00714.52
5.6.390.0030.00614.98
5.6.380.0000.01714.77
5.6.370.0030.00914.63
5.6.360.0070.00714.55
5.6.350.0070.00314.52
5.6.340.0060.00914.45
5.6.330.0080.00414.60
5.6.320.0000.00914.71
5.6.310.0070.00714.42
5.6.300.0070.00314.37
5.6.290.0030.00814.49
5.6.280.0070.03917.67
5.6.270.0060.00914.62
5.6.260.0030.01014.64
5.6.250.0060.00614.66
5.6.240.0100.02317.67
5.6.230.0180.02317.53
5.6.220.0080.04517.71
5.6.210.0050.04317.59
5.6.200.0080.04317.77
5.6.190.0020.03817.90
5.6.180.0110.03917.70
5.6.170.0100.04017.81
5.6.160.0120.02517.92
5.6.150.0090.04017.66
5.6.140.0120.03017.83
5.6.130.0020.03917.91
5.6.120.0060.04817.78
5.6.110.0020.02817.72
5.6.100.0060.03017.72
5.6.90.0020.03517.68
5.6.80.0030.04317.39
5.6.70.0090.03217.39
5.6.60.0020.04817.51
5.6.50.0140.02017.30
5.6.40.0030.02717.29
5.6.30.0030.03617.40
5.6.20.0050.02617.43
5.6.10.0050.02817.50
5.6.00.0080.04217.61
5.5.380.0110.03717.49
5.5.370.0110.02517.51
5.5.360.0030.04317.52
5.5.350.0030.05417.41
5.5.340.0070.04217.62
5.5.330.0020.04717.71
5.5.320.0080.02817.62
5.5.310.0070.03017.70
5.5.300.0040.03217.65
5.5.290.0040.04417.65
5.5.280.0170.03017.55
5.5.270.0110.04317.59
5.5.260.0050.03817.70
5.5.250.0080.04517.61
5.5.240.0080.04317.25
5.5.230.0080.02217.41
5.5.220.0050.03017.42
5.5.210.0100.04017.32
5.5.200.0080.03717.34
5.5.190.0110.03117.29
5.5.180.0050.03317.22
5.5.170.0070.00314.40
5.5.160.0020.04517.21
5.5.150.0090.04217.34
5.5.140.0070.04217.24
5.5.130.0100.03017.28
5.5.120.0100.03417.30
5.5.110.0090.04417.21
5.5.100.0100.04217.19
5.5.90.0050.04517.25
5.5.80.0070.03417.18
5.5.70.0050.03817.35
5.5.60.0060.02917.17
5.5.50.0100.03817.12
5.5.40.0110.03317.11
5.5.30.0060.04117.22
5.5.20.0030.04217.19
5.5.10.0070.04717.26
5.5.00.0120.04017.11
5.4.450.0030.04315.23
5.4.440.0100.03715.24
5.4.430.0000.02915.31
5.4.420.0070.03715.16
5.4.410.0020.04515.18
5.4.400.0090.03815.12
5.4.390.0070.02015.07
5.4.380.0100.03715.03
5.4.370.0050.03315.04
5.4.360.0030.02515.04
5.4.350.0060.04015.04
5.4.340.0020.02915.12
5.4.330.0070.00411.10
5.4.320.0060.02215.14
5.4.310.0080.03215.24
5.4.300.0080.03515.12
5.4.290.0060.02615.01
5.4.280.0050.03614.99
5.4.270.0070.04514.89
5.4.260.0050.02715.09
5.4.250.0040.04314.96
5.4.240.0030.03515.03
5.4.230.0070.04015.02
5.4.220.0070.04314.98
5.4.210.0110.02215.10
5.4.200.0080.03115.06
5.4.190.0040.03114.94
5.4.180.0030.02315.13
5.4.170.0100.02814.86
5.4.160.0030.04315.03
5.4.150.0100.03414.95
5.4.140.0140.03313.57
5.4.130.0030.03913.87
5.4.120.0080.03913.55
5.4.110.0090.01913.70
5.4.100.0020.02513.87
5.4.90.0050.03713.86
5.4.80.0080.02713.91
5.4.70.0070.02313.78
5.4.60.0060.02613.59
5.4.50.0100.03413.63
5.4.40.0080.03713.68
5.4.30.0090.03413.86
5.4.20.0070.03013.62
5.4.10.0090.03313.70
5.4.00.0080.03213.56
5.3.290.0050.02212.46
5.3.280.0050.03312.41
5.3.270.0030.02512.38
5.3.260.0050.03812.38
5.3.250.0070.03012.40
5.3.240.0020.04612.40
5.3.230.0040.02812.41
5.3.220.0080.04112.37
5.3.210.0030.04412.33
5.3.200.0070.02112.39
5.3.190.0080.02212.36
5.3.180.0030.02112.34
5.3.170.0050.02812.40
5.3.160.0090.03512.43
5.3.150.0030.02612.41
5.3.140.0050.02412.38
5.3.130.0090.02112.39
5.3.120.0020.03012.37
5.3.110.0030.02212.37
5.3.100.0030.04212.11
5.3.90.0020.02612.06
5.3.80.0070.02012.14
5.3.70.0000.03112.11
5.3.60.0080.03612.10
5.3.50.0080.02712.03
5.3.40.0050.04212.08
5.3.30.0030.02312.07
5.3.20.0040.02211.90
5.3.10.0020.02811.92
5.3.00.0060.02611.87
5.2.170.0030.03311.13
5.2.160.0030.03011.16
5.2.150.0030.05311.19
5.2.140.0030.03311.16
5.2.130.0030.03010.95
5.2.120.0000.05311.02
5.2.110.0070.05711.13
5.2.100.0070.05711.12
5.2.90.0030.03711.14
5.2.80.0070.06311.04
5.2.70.0000.05011.04
5.2.60.0170.03311.04
5.2.50.0170.05010.83
5.2.40.0030.04011.02
5.2.30.0100.05711.00
5.2.20.0000.05310.95
5.2.10.0070.05710.87
5.2.00.0100.05310.72
5.1.60.0000.05010.69
5.1.50.0030.05310.69
5.1.40.0030.05310.69
5.1.30.0070.05010.69
5.1.20.0100.05010.69
5.1.10.0030.05010.69
5.1.00.0070.03710.69
5.0.50.0070.03310.69
5.0.40.0000.04010.69
5.0.30.0030.04010.69
5.0.20.0030.04010.69
5.0.10.0100.04010.69
5.0.00.0000.05310.69
4.4.90.0000.03710.69
4.4.80.0130.02010.69
4.4.70.0070.03310.69
4.4.60.0000.03010.69
4.4.50.0030.02710.69
4.4.40.0000.04710.69
4.4.30.0000.02710.69
4.4.20.0000.02710.69
4.4.10.0000.01710.69
4.4.00.0000.05710.69
4.3.110.0000.02310.69
4.3.100.0030.03310.69
4.3.90.0000.02710.69
4.3.80.0070.04310.69
4.3.70.0100.02710.69
4.3.60.0100.02710.69
4.3.50.0030.02710.69
4.3.40.0000.05310.69
4.3.30.0000.03710.69
4.3.20.0000.02710.69
4.3.10.0000.03010.69
4.3.00.0030.02710.69

preferences:
37.79 ms | 400 KiB | 5 Q