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); // 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)
8.3.90.0270.00726.77
8.3.60.0330.01825.92
8.3.50.0130.01325.92
8.3.40.0180.01425.92
8.3.30.0190.00825.92
8.3.20.0210.00525.92
8.3.10.0240.00623.91
8.3.00.0290.00322.38
8.2.180.0320.00725.92
8.2.170.0400.00725.92
8.2.160.0310.01025.92
8.2.150.0330.00725.92
8.2.140.0180.01423.19
8.2.130.0230.01423.21
8.2.120.0290.00922.57
8.2.110.0240.00722.58
8.2.100.0280.00522.47
8.2.90.0200.01022.50
8.2.80.0280.00322.53
8.2.70.0200.01122.32
8.2.60.0220.00722.34
8.2.50.0150.01121.46
8.2.40.0120.00820.61
8.2.30.0150.00620.52
8.2.20.0160.00320.49
8.2.10.0220.00520.52
8.2.00.0170.00620.00
8.1.290.0210.01030.84
8.1.280.0200.01425.92
8.1.270.0270.00723.98
8.1.260.0290.00723.99
8.1.250.0200.01124.06
8.1.240.0240.00722.35
8.1.230.0240.00422.30
8.1.220.0230.00622.55
8.1.210.0230.00622.30
8.1.200.0190.00522.36
8.1.190.0170.00522.30
8.1.180.0090.00720.61
8.1.170.0130.00720.70
8.1.160.0150.00620.45
8.1.150.0150.00720.43
8.1.140.0170.00520.39
8.1.130.0130.00520.05
8.1.120.0130.00519.39
8.1.110.0120.00719.36
8.1.100.0100.00518.92
8.1.90.0100.00618.79
8.1.80.0120.00619.01
8.1.70.0110.00718.99
8.1.60.0120.00618.95
8.1.50.0140.00418.59
8.1.40.0130.00618.79
8.1.30.0140.00618.83
8.1.20.0140.00618.66
8.1.10.0100.00618.38
8.1.00.0130.00618.42
8.0.300.0170.00622.00
8.0.290.0170.00250.62
8.0.280.0180.00420.28
8.0.270.0180.00220.22
8.0.260.0140.00519.25
8.0.250.0110.00519.00
8.0.240.0100.00619.04
8.0.230.0090.00718.77
8.0.220.0110.00418.59
8.0.210.0130.00618.58
8.0.200.0130.00318.62
8.0.190.0120.00518.45
8.0.180.0120.00518.16
8.0.170.0140.00318.17
8.0.160.0140.00418.18
8.0.150.0110.00617.94
8.0.140.0130.00417.92
8.0.130.0120.00517.84
8.0.120.0130.00517.41
8.0.110.0120.00417.42
8.0.100.0110.00517.35
8.0.90.0110.00317.33
8.0.80.0110.00517.33
8.0.70.0100.00617.35
8.0.60.0110.00417.32
8.0.50.0110.00517.33
8.0.30.0110.00717.27
8.0.20.0110.00717.32
8.0.10.0120.00717.34
8.0.00.0100.00817.31
7.4.330.0120.00217.90
7.4.320.0140.00618.80
7.4.300.0160.00418.34
7.4.290.0140.00417.84
7.4.280.0130.00717.84
7.4.270.0140.00517.65
7.4.260.0130.00517.54
7.4.250.0130.00517.07
7.4.240.0140.00417.12
7.4.230.0130.00417.09
7.4.220.0110.00517.09
7.4.210.0110.00517.06
7.4.200.0100.00517.03
7.4.190.0100.00617.11
7.4.180.0100.00517.11
7.4.160.0100.00716.99
7.4.150.0120.00616.93
7.4.140.0120.00716.81
7.4.130.0110.00716.76
7.4.120.0110.00716.76
7.4.110.0110.00916.74
7.4.100.0120.00716.75
7.4.90.0120.00716.72
7.4.80.0130.00716.74
7.4.70.0120.00816.74
7.4.60.0110.00816.71
7.4.50.0120.00816.68
7.4.40.0110.00916.65
7.4.30.0120.00916.67
7.4.20.0120.00816.68
7.4.10.0110.00916.61
7.4.00.0110.00816.68
7.3.330.0140.00517.37
7.3.320.0150.00316.98
7.3.310.0120.00416.95
7.3.300.0120.00516.96
7.3.290.0110.00516.88
7.3.280.0120.00416.82
7.3.270.0120.00616.75
7.3.260.0130.00516.71
7.3.250.0120.00716.73
7.3.240.0120.00816.69
7.3.230.0110.00816.65
7.3.220.0120.00716.69
7.3.210.0130.00716.65
7.3.200.0130.00716.68
7.3.190.0130.00716.66
7.3.180.0120.00716.65
7.3.170.0120.00816.63
7.3.160.0110.00816.62
7.3.150.0120.00816.62
7.3.140.0130.00716.64
7.3.130.0120.00816.59
7.3.120.0110.00816.56
7.3.110.0110.00916.54
7.3.100.0120.00816.45
7.3.90.0110.00816.45
7.3.80.0110.00816.41
7.3.70.0110.00816.39
7.3.60.0110.00816.36
7.3.50.0110.00816.32
7.3.40.0110.00816.32
7.3.30.0110.00816.25
7.3.20.0200.00716.50
7.3.10.0190.00816.46
7.3.00.0230.00816.44
7.2.340.0160.00716.84
7.2.330.0150.00816.81
7.2.320.0150.00816.87
7.2.310.0140.00816.83
7.2.300.0140.00816.82
7.2.290.0140.00916.79
7.2.280.0130.00916.77
7.2.270.0130.00916.79
7.2.260.0130.00916.75
7.2.250.0130.00916.75
7.2.240.0130.00916.73
7.2.230.0130.00916.64
7.2.220.0130.00916.61
7.2.210.0130.00916.59
7.2.200.0140.00816.59
7.2.190.0130.00916.54
7.2.180.0120.00916.51
7.2.170.0120.00916.52
7.2.160.0120.00916.46
7.2.150.0210.00916.70
7.2.140.0210.00816.73
7.2.130.0290.00916.69
7.2.120.0220.00916.69
7.2.110.0220.00816.68
7.2.100.0270.00816.63
7.2.90.0270.00916.64
7.2.80.0260.00916.64
7.2.70.0270.00816.66
7.2.60.0250.00916.66
7.2.50.0250.00816.65
7.2.40.0260.00816.67
7.2.30.0280.00916.69
7.2.20.0260.00916.67
7.2.10.0250.00816.67
7.2.00.0250.00816.68
7.1.330.0180.00816.02
7.1.320.0170.00915.86
7.1.310.0180.00815.84
7.1.300.0170.00815.79
7.1.290.0180.00815.79
7.1.280.0170.00815.76
7.1.270.0210.00815.72
7.1.260.0190.00915.67
7.1.250.0250.00815.57
7.1.240.0230.00815.57
7.1.230.0260.00815.58
7.1.220.0290.00815.56
7.1.210.0320.00815.56
7.1.200.0290.00815.56
7.1.190.0310.00715.56
7.1.180.0290.00815.53
7.1.170.0290.00815.55
7.1.160.0270.00815.52
7.1.150.0280.00915.54
7.1.140.0280.00815.55
7.1.130.0290.00815.54
7.1.120.0260.00815.52
7.1.110.0250.00815.56
7.1.100.0290.00815.57
7.1.90.0270.00815.56
7.1.80.0260.00815.59
7.1.70.0250.00815.54
7.1.60.0250.00916.18
7.1.50.0270.00816.15
7.1.40.0240.00816.19
7.1.30.0250.00816.18
7.1.20.0250.00816.15
7.1.10.0240.00815.56
7.1.00.0250.00815.52
7.0.330.0260.00715.26
7.0.320.0270.00815.29
7.0.310.0300.00715.24
7.0.300.0270.00815.24
7.0.290.0260.00815.26
7.0.280.0250.00815.25
7.0.270.0290.00815.26
7.0.260.0250.00815.24
7.0.250.0260.00815.31
7.0.240.0300.00715.33
7.0.230.0250.00815.33
7.0.220.0250.00815.31
7.0.210.0280.00815.29
7.0.200.0250.00815.31
7.0.190.0250.00815.31
7.0.180.0230.00815.30
7.0.170.0230.00815.34
7.0.160.0240.00815.30
7.0.150.0230.00815.30
7.0.140.0280.00715.31
7.0.130.0220.00815.34
7.0.120.0230.00815.31
7.0.110.0240.00715.31
7.0.100.0230.00815.29
7.0.90.0230.00715.27
7.0.80.0240.00815.24
7.0.70.0220.00815.25
7.0.60.0220.00815.25
7.0.50.0220.00815.26
7.0.40.0220.00815.25
7.0.30.0230.00815.23
7.0.20.0230.00815.23
7.0.10.0220.00815.25
7.0.00.0230.00815.21
5.6.400.0150.00915.82
5.6.390.0150.01015.84
5.6.380.0150.00915.69
5.6.370.0150.00915.72
5.6.360.0150.01015.70
5.6.350.0150.01015.71
5.6.340.0160.00915.69
5.6.330.0160.00915.71
5.6.320.0160.00915.72
5.6.310.0150.00915.70
5.6.300.0160.01015.68
5.6.290.0160.00915.71
5.6.280.0150.01015.72
5.6.270.0150.00915.72
5.6.260.0150.01015.71
5.6.250.0160.00915.71
5.6.240.0150.00915.71
5.6.230.0160.00915.73
5.6.220.0160.00915.71
5.6.210.0160.00915.70
5.6.200.0160.00915.71
5.6.190.0150.00915.74
5.6.180.0160.01015.70
5.6.170.0160.00915.73
5.6.160.0150.00915.71
5.6.150.0160.01015.72
5.6.140.0160.00915.72
5.6.130.0160.01015.73
5.6.120.0160.00915.70
5.6.110.0160.00915.70
5.6.100.0160.00915.70
5.6.90.0160.00915.68
5.6.80.0150.01015.64
5.6.70.0140.01015.68
5.6.60.0150.00915.65
5.6.50.0150.01015.62
5.6.40.0160.00915.65
5.6.30.0150.00915.65
5.6.20.0140.01015.61
5.6.10.0150.00915.63
5.6.00.0160.00915.61
5.5.380.0160.00915.39
5.5.370.0150.00915.39
5.5.360.0160.01015.36
5.5.350.0150.00915.36
5.5.340.0160.00915.34
5.5.330.0160.00915.34
5.5.320.0150.01015.33
5.5.310.0160.00915.37
5.5.300.0170.00915.35
5.5.290.0160.00915.36
5.5.280.0160.00915.36
5.5.270.0160.00915.33
5.5.260.0160.00915.34
5.5.250.0160.00915.30
5.5.240.0150.01015.32
5.5.230.0160.00915.31
5.5.220.0150.00915.31
5.5.210.0150.00915.30
5.5.200.0150.01015.28
5.5.190.0160.00915.27
5.5.180.0160.00915.28
5.5.170.0160.00915.44
5.5.160.0150.00915.28
5.5.150.0150.01015.28
5.5.140.0160.00915.27
5.5.130.0160.00915.25
5.5.120.0150.00915.24
5.5.110.0150.00915.28
5.5.100.0150.01015.28
5.5.90.0150.00915.30
5.5.80.0150.00915.30
5.5.70.0160.00915.30
5.5.60.0150.01015.26
5.5.50.0150.00915.27
5.5.40.0150.00915.28
5.5.30.0150.00915.29
5.5.20.0150.00915.28
5.5.10.0150.01015.23
5.5.00.0150.00915.25
5.4.450.0130.00612.77
5.4.440.0120.00712.77
5.4.430.0130.00612.77
5.4.420.0130.00612.76
5.4.410.0130.00712.77
5.4.400.0130.00612.72
5.4.390.0130.00612.72
5.4.380.0130.00612.73
5.4.370.0130.00712.72
5.4.360.0130.00612.72
5.4.350.0120.00712.73
5.4.340.0130.00712.72
5.4.330.0130.00712.73
5.4.320.0130.00712.71
5.4.310.0130.00712.74
5.4.300.0130.00712.74
5.4.290.0130.00712.72
5.4.280.0130.00612.72
5.4.270.0130.00612.72
5.4.260.0130.00612.70
5.4.250.0130.00612.70
5.4.240.0130.00712.71
5.4.230.0130.00712.67
5.4.220.0130.00612.69
5.4.210.0130.00712.67
5.4.200.0130.00612.68
5.4.190.0130.00612.68
5.4.180.0130.00712.67
5.4.170.0130.00712.68
5.4.160.0120.00712.69
5.4.150.0120.00712.68
5.4.140.0130.00612.74
5.4.130.0120.00712.72
5.4.120.0120.00612.74
5.4.110.0120.00712.76
5.4.100.0130.00612.74
5.4.90.0120.00712.73
5.4.80.0120.00612.75
5.4.70.0110.00712.75
5.4.60.0120.00712.76
5.4.50.0110.00712.72
5.4.40.0120.00712.75
5.4.30.0120.00712.75
5.4.20.0120.00712.75
5.4.10.0120.00612.75
5.4.00.0120.00612.71
5.3.290.0130.00712.60
5.3.280.0130.00712.46
5.3.270.0130.00712.53
5.3.260.0120.00712.52
5.3.250.0120.00712.52
5.3.240.0120.00712.44
5.3.230.0120.00712.49
5.3.220.0120.00712.47
5.3.210.0120.00812.47
5.3.200.0120.00712.49
5.3.190.0120.00712.53
5.3.180.0120.00712.63
5.3.170.0120.00712.63
5.3.160.0120.00712.63
5.3.150.0130.00712.63
5.3.140.0120.00712.58
5.3.130.0120.00712.58
5.3.120.0120.00712.56
5.3.110.0130.00712.57
5.3.100.0120.00712.58
5.3.90.0120.00712.62
5.3.80.0120.00712.53
5.3.70.0120.00712.54
5.3.60.0110.00712.55
5.3.50.0110.00712.52
5.3.40.0120.00712.51
5.3.30.0120.00712.51
5.3.20.0110.00712.50
5.3.10.0110.00712.35
5.3.00.0110.00712.34

preferences:
59.11 ms | 403 KiB | 5 Q