3v4l.org

run code in 300+ PHP versions simultaneously
<?php $open_hours = array ( "Sun" => "11am-12am", "Mon" => "11am-12am", "Tue" => "11am-12am", "Wed" => "10am-12am", "Thu" => "9am-12am", "Fri" => "11am-12am", "Sat" => "11am-12am" ); $result = []; $previous = false; foreach ($open_hours as $day => $hours) { if (!$previous || $previous !== $hours) { $result[$hours][] = $day; } elseif ($previous === $hours) { $key = array_key_last($result[$hours]); $current = strtok($result[$hours][$key], '-'); $result[$hours][$key] = $current.'-'.$day; } $previous = $hours; } // build output (joining days with ,) $output = []; foreach ($result as $hours => $days) { $output[] = implode(', ', $days).': '.$hours; } // join with ;'s and output echo implode('; ', $output);

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.5.30.0090.00717.53
8.5.20.0090.01119.90
8.5.10.0130.01016.79
8.5.00.0150.00719.94
8.4.180.0110.01022.03
8.4.170.0100.01124.00
8.4.160.0120.01022.90
8.4.150.0080.00616.87
8.4.140.0130.00817.50
8.4.130.0120.00917.65
8.4.120.0110.00922.34
8.4.110.0100.00718.92
8.4.100.0040.00417.78
8.4.90.0120.00820.72
8.4.80.0120.00619.12
8.4.70.0150.00517.89
8.4.60.0110.01020.42
8.4.50.0090.01217.69
8.4.40.0100.01018.67
8.4.30.0090.00020.80
8.4.20.0130.00617.88
8.4.10.0040.01520.67
8.3.300.0100.01020.74
8.3.290.0110.01020.75
8.3.280.0130.00718.29
8.3.270.0100.01016.74
8.3.260.0120.00716.66
8.3.250.0130.00517.35
8.3.240.0080.01216.61
8.3.230.0050.00516.78
8.3.220.0090.00918.82
8.3.210.0120.00616.67
8.3.200.0120.00916.18
8.3.190.0080.00616.71
8.3.180.0120.00816.65
8.3.170.0060.01216.73
8.3.160.0150.00318.39
8.3.150.0070.01118.19
8.3.140.0120.00318.23
8.3.130.0040.00418.44
8.3.120.0030.00618.95
8.3.110.0060.00316.75
8.3.100.0040.00418.41
8.3.90.0080.00026.77
8.3.80.0060.00319.36
8.3.70.0060.01616.63
8.3.60.0090.00616.38
8.3.50.0190.01323.63
8.3.40.0030.01022.03
8.3.30.0110.01118.59
8.3.20.0030.00624.18
8.3.10.0030.00524.66
8.3.00.0000.00726.16
8.2.300.0130.01217.89
8.2.290.0060.00316.59
8.2.280.0110.00820.54
8.2.270.0130.00717.00
8.2.260.0000.00816.57
8.2.250.0000.00818.28
8.2.240.0080.00018.75
8.2.230.0000.00920.94
8.2.220.0030.00524.06
8.2.210.0060.01226.77
8.2.200.0030.00618.88
8.2.190.0140.00016.61
8.2.180.0170.00025.92
8.2.170.0030.01119.08
8.2.160.0100.00722.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00426.35
8.2.110.0070.00321.13
8.2.100.0040.00717.91
8.2.90.0080.00018.34
8.2.80.0050.00317.97
8.2.70.0040.00417.93
8.2.60.0040.00418.27
8.2.50.0030.00518.10
8.2.40.0000.00820.42
8.2.30.0030.00518.11
8.2.20.0050.00218.11
8.2.10.0040.00419.42
8.2.00.0040.00419.22
8.1.340.0100.00117.68
8.1.330.0030.00516.04
8.1.320.0100.00916.34
8.1.310.0050.00318.26
8.1.300.0030.00716.10
8.1.290.0040.00430.84
8.1.280.0100.00325.92
8.1.270.0030.00623.99
8.1.260.0050.00328.09
8.1.250.0050.00228.09
8.1.240.0070.00717.57
8.1.230.0060.00621.00
8.1.220.0000.00717.74
8.1.210.0040.00420.95
8.1.200.0040.00417.48
8.1.190.0040.00417.35
8.1.180.0000.00718.10
8.1.170.0080.00018.52
8.1.160.0040.00718.80
8.1.150.0040.00418.88
8.1.140.0030.00518.85
8.1.130.0040.00417.45
8.1.120.0050.00317.51
8.1.110.0070.00017.45
8.1.100.0000.00717.47
8.1.90.0070.00017.44
8.1.80.0030.00617.46
8.1.70.0030.00317.36
8.1.60.0050.00317.65
8.1.50.0050.00517.50
8.1.40.0050.00317.40
8.1.30.0000.00817.55
8.1.20.0000.00817.62
8.1.10.0040.00417.62
8.1.00.0050.00317.51
8.0.300.0070.00019.60
8.0.290.0000.00916.88
8.0.280.0050.00318.43
8.0.270.0040.00418.01
8.0.260.0000.00716.74
8.0.250.0090.00016.95
8.0.240.0000.00816.83
8.0.230.0050.00216.83
8.0.220.0080.00016.88
8.0.210.0030.00516.78
8.0.200.0030.00316.85
8.0.190.0090.00016.85
8.0.180.0050.00316.91
8.0.170.0040.00416.79
8.0.160.0000.00816.85
8.0.150.0000.00716.87
8.0.140.0040.00416.82
8.0.130.0030.00313.25
8.0.120.0060.00316.75
8.0.110.0070.00016.92
8.0.100.0000.00716.76
8.0.90.0040.00416.93
8.0.80.0040.01116.84
8.0.70.0050.00316.79
8.0.60.0050.00217.01
8.0.50.0000.00716.91
8.0.30.0120.00516.97
8.0.20.0090.01017.06
8.0.10.0070.01016.95
8.0.00.0080.01416.83
7.4.330.0020.00215.55
7.4.320.0030.00316.45
7.4.300.0040.00416.59
7.4.290.0050.00316.61
7.4.280.0000.00716.39
7.4.270.0070.00016.41
7.4.260.0000.00513.24
7.4.250.0030.00316.57
7.4.240.0020.00616.56
7.4.230.0030.00316.70
7.4.220.0020.00516.48
7.4.210.0080.00916.56
7.4.200.0040.00416.59
7.4.160.0030.01216.56
7.4.150.0130.00616.52
7.4.140.0110.00416.43
7.4.130.0110.00716.57
7.4.120.0070.01016.46
7.4.110.0120.00716.52
7.4.100.0120.01116.33
7.4.90.0090.00916.44
7.4.80.0160.00716.31
7.4.70.0150.00616.40
7.4.60.0140.01016.45
7.4.50.0120.00916.29
7.4.40.0150.00616.40
7.4.30.0130.00716.23
7.4.20.0160.00616.45
7.4.10.0130.00816.42
7.4.00.0040.01116.55
7.3.330.0040.00416.41
7.3.320.0060.00013.08
7.3.310.0070.00016.28
7.3.300.0000.00716.38
7.3.290.0060.00916.34
7.3.270.0030.01116.28
7.3.260.0050.01116.41
7.3.250.0150.00316.35
7.3.240.0120.00316.42
7.3.230.0110.00816.32
7.3.220.0150.00716.23
7.3.210.0120.00816.24
7.3.200.0150.00816.28
7.3.190.0130.00716.32
7.3.180.0150.00516.18
7.3.170.0100.00916.16
7.3.160.0170.00316.17
7.3.150.0130.01016.25
7.3.140.0120.00916.29
7.3.130.0180.00516.19
7.3.120.0150.00616.41
7.3.110.0180.00516.17
7.3.100.0120.01016.31
7.3.90.0120.00916.56
7.3.80.0130.00916.27
7.3.70.0160.00516.38
7.3.60.0130.00716.41
7.3.50.0110.00916.46
7.3.40.0120.01016.44
7.3.30.0130.00916.32
7.3.20.0250.00416.37
7.3.10.0190.01116.40
7.3.00.0120.00916.46
7.2.340.0110.00816.47
7.2.330.0140.01016.48
7.2.320.0110.01216.45
7.2.310.0120.00916.50
7.2.300.0130.01116.44
7.2.290.0090.01316.32
7.2.280.0160.00916.46
7.2.270.0150.00716.32
7.2.260.0180.00416.53
7.2.250.0150.01016.51
7.2.240.0150.00616.49
7.2.230.0140.00716.58
7.2.220.0140.01016.46
7.2.210.0130.01216.45
7.2.200.0110.01116.47
7.2.190.0110.01216.46
7.2.180.0170.00416.51
7.2.170.0170.00516.48
7.2.160.0120.01216.56
7.2.150.0140.00816.56
7.2.140.0110.01116.61
7.2.130.0140.01016.61
7.2.120.0110.00916.64
7.2.110.0090.01116.58
7.2.100.0230.00816.72
7.2.90.0120.01016.71
7.2.80.0080.01116.63
7.2.70.0070.01316.63
7.2.60.0140.00916.55
7.2.50.0110.01116.51
7.2.40.0100.01316.60
7.2.30.0130.00616.57
7.2.20.0090.01116.52
7.2.10.0090.00816.53
7.2.00.0170.00716.65
5.6.00.0100.00115.87

preferences:
58.37 ms | 1534 KiB | 5 Q