3v4l.org

run code in 300+ PHP versions simultaneously
<?php $records = [ 'nonsense', 'f', 'h', 1, 2, 3, 4, 'f', 'nonsense', 'h', 1, 2, 'f', 'h', 1, 2, 3, 'f', 'nonsense', 'nonsense', 'nonsense', 'h', 1, 2, 3, 4, 'f', 'h', 1, 'f', 'nonsense' ]; $groups = []; foreach ($records as $record) { if ($record === 'h') { $group = []; } $group[] = $record; if ($record === 'f') { $groups[] = $group; } } var_dump($groups); echo "\n------------------------------------------------------\n\n"; unset($group); $groups = []; foreach ($records as $record) { if ($record === 'h') { $group = []; } if (! isset($group)) { continue; } $group[] = $record; if ($record === 'f') { $groups[] = $group; unset($group); } } var_dump($groups);

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.60.0120.00618.55
8.3.50.0070.00716.61
8.3.40.0180.00418.71
8.3.30.0130.00318.67
8.3.20.0080.00021.90
8.3.10.0060.00323.62
8.3.00.0030.00618.09
8.2.180.0090.00925.92
8.2.170.0140.00719.00
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0000.00724.66
8.2.130.0000.00926.16
8.2.120.0050.00319.95
8.2.110.0090.00022.31
8.2.100.0060.00617.91
8.2.90.0060.00317.75
8.2.80.0040.00417.97
8.2.70.0080.00017.75
8.2.60.0040.00417.63
8.2.50.0030.00617.80
8.2.40.0060.00318.16
8.2.30.0060.00321.09
8.2.20.0020.00518.09
8.2.10.0040.00417.97
8.2.00.0040.00418.20
8.1.280.0150.01125.92
8.1.270.0050.00323.91
8.1.260.0060.00326.35
8.1.250.0060.00328.09
8.1.240.0060.00323.84
8.1.230.0090.00322.66
8.1.220.0030.00517.76
8.1.210.0000.00818.77
8.1.200.0060.00617.23
8.1.190.0000.00817.23
8.1.180.0060.00318.10
8.1.170.0080.00017.62
8.1.160.0040.00418.91
8.1.150.0000.00720.29
8.1.140.0070.00319.52
8.1.130.0000.00718.92
8.1.120.0050.00217.49
8.1.110.0040.00417.50
8.1.100.0040.00417.38
8.1.90.0040.00317.50
8.1.80.0050.00217.39
8.1.70.0050.00217.45
8.1.60.0030.00517.44
8.1.50.0000.00817.56
8.1.40.0000.00817.44
8.1.30.0040.00417.70
8.1.20.0030.00517.68
8.1.10.0030.00517.51
8.1.00.0000.00817.41
8.0.300.0000.00720.08
8.0.290.0070.00016.75
8.0.280.0000.00718.38
8.0.270.0030.00317.21
8.0.260.0070.00016.91
8.0.250.0030.00317.00
8.0.240.0040.00416.89
8.0.230.0030.00517.05
8.0.220.0000.00716.97
8.0.210.0040.00416.88
8.0.200.0030.00317.05
8.0.190.0000.00816.85
8.0.180.0070.00017.01
8.0.170.0070.00016.97
8.0.160.0070.00316.92
8.0.150.0080.00016.77
8.0.140.0040.00416.89
8.0.130.0060.00013.39
8.0.120.0050.00216.88
8.0.110.0000.00716.87
8.0.100.0040.00417.04
8.0.90.0000.00816.77
8.0.80.0060.01016.92
8.0.70.0030.00516.86
8.0.60.0040.00416.96
8.0.50.0030.00516.91
8.0.30.0090.00817.10
8.0.20.0150.00617.40
8.0.10.0040.00416.94
8.0.00.0090.01216.88
7.4.330.0060.00015.55
7.4.320.0000.00716.50
7.4.300.0030.00316.64
7.4.290.0000.00716.62
7.4.280.0040.00416.64
7.4.270.0000.00716.55
7.4.260.0000.00716.53
7.4.250.0000.00716.51
7.4.240.0000.00716.56
7.4.230.0030.00316.52
7.4.220.0160.00316.49
7.4.210.0080.01216.43
7.4.200.0000.00816.45
7.4.160.0110.00916.58
7.4.150.0110.00817.40
7.4.140.0130.01017.86
7.4.130.0140.00716.48
7.4.120.0080.01316.52
7.4.110.0110.00716.49
7.4.100.0110.01116.54
7.4.90.0090.01116.51
7.4.80.0070.01019.39
7.4.70.0070.01116.62
7.4.60.0070.01016.41
7.4.50.0110.00416.60
7.4.40.0040.01416.63
7.4.30.0140.00416.47
7.4.00.0060.00914.80
7.3.330.0030.00313.10
7.3.320.0030.00313.09
7.3.310.0050.00216.40
7.3.300.0000.00816.16
7.3.290.0060.01116.32
7.3.280.0100.00816.34
7.3.270.0090.00917.40
7.3.260.0130.00516.46
7.3.250.0080.01116.44
7.3.240.0100.01016.50
7.3.230.0130.00616.57
7.3.210.0100.00716.38
7.3.200.0090.01516.52
7.3.190.0070.01016.31
7.3.180.0090.01316.46
7.3.170.0080.00816.53
7.3.160.0130.00616.45
7.2.330.0110.00816.37
7.2.320.0110.01516.46
7.2.310.0090.01616.80
7.2.300.0100.00916.81
7.2.290.0070.01716.77
7.2.80.0160.00416.24
7.2.60.0070.00717.12
7.2.50.0000.01216.86
7.1.200.0070.00415.81
7.1.70.0000.00817.08
7.1.60.1700.01333.30
7.1.50.2130.00332.98
7.1.40.1430.01032.81
7.1.30.2130.01332.78
7.1.20.1630.02032.74
7.1.10.1030.01014.56
7.1.00.0200.00314.63
7.0.200.1930.00015.04
7.0.190.2270.01314.83
7.0.180.1500.01314.44
7.0.170.1830.01014.51
7.0.160.2330.00714.57
7.0.150.1200.00714.47
7.0.140.1470.01014.46
7.0.130.0070.01714.66
7.0.120.0200.00714.58
7.0.110.1270.02014.59
7.0.100.0100.01014.43
7.0.90.0770.00314.19
7.0.80.0100.01714.68
7.0.70.2030.01714.32
7.0.60.0070.01014.11
7.0.50.2770.01014.68
7.0.40.0070.01314.73
7.0.30.0030.01314.82
7.0.20.1070.01314.84
7.0.10.1600.01314.65
7.0.00.1670.01014.77

preferences:
43.65 ms | 400 KiB | 5 Q