3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pizzas = [ ['cheese', 'tomato', 'ham', 'beef', 'pineapple'], ['bacon', 'ham', 'cheese'], ['cheese', 'tomato', 'bacon', 'chili', 'salad'], ['tomato', 'salad', 'pineapple'], ['tomato', 'beef', 'bacon'], ['cheese', 'tomato', 'bacon', 'chili', 'salad', 'anchovies'], ['tomato', 'pineapple', 'bacon', 'cheese', 'ham'], ]; $included_wish = ['cheese', 'ham', 'bacon']; $excluded_wish = ['pineapple']; $percentages = []; $wishCount = count($included_wish); foreach ($pizzas as $pizza) { if (array_intersect($excluded_wish, $pizza)) { continue; } $result[] = [ 'perc' => count(array_intersect($included_wish, $pizza)) / $wishCount, 'additional' => count(array_diff($pizza, $included_wish)), 'ingredients' => implode(', ', $pizza), ]; } usort($result, fn($a, $b) => [$b['perc'], $a['additional']] <=> [$a['perc'], $b['additional']]); foreach ($result as $row) { vprintf("wished: %.02f%%, surplus toppings: %d : %s\n", $row); }

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.00.0120.01019.98
8.4.150.0020.00014.05
8.4.140.0120.00917.54
8.4.130.0100.01117.64
8.4.120.0150.00420.47
8.4.110.0050.00518.85
8.4.100.0140.00817.70
8.4.90.0120.00820.37
8.4.80.0100.00918.95
8.4.70.0080.01218.55
8.4.60.0140.00619.02
8.4.50.0120.00720.52
8.4.40.0100.00320.50
8.4.30.0080.00823.69
8.4.20.0170.01019.40
8.4.10.0100.01022.14
8.3.280.0110.00818.25
8.3.270.0100.00916.93
8.3.260.0090.01116.63
8.3.250.0110.00818.98
8.3.240.0100.00716.59
8.3.230.0140.00516.77
8.3.220.0130.00618.95
8.3.210.0110.00318.75
8.3.200.0060.00316.43
8.3.190.0090.00817.14
8.3.180.0110.00818.78
8.3.170.0040.01519.09
8.3.160.0030.00517.11
8.3.150.0130.00618.96
8.3.140.0110.00720.77
8.3.130.0040.00418.30
8.3.120.0080.00418.87
8.3.110.0040.00820.94
8.3.100.0070.01016.62
8.3.90.0140.00026.77
8.3.80.0090.00018.43
8.3.70.0150.00016.63
8.3.60.0110.00716.50
8.3.50.0090.01216.84
8.3.40.0060.00921.68
8.3.30.0120.00318.53
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0070.00216.90
8.2.280.0120.00918.38
8.2.270.0000.02016.54
8.2.260.0070.01116.91
8.2.250.0060.00316.54
8.2.240.0050.00319.11
8.2.230.0050.00522.58
8.2.220.0040.00424.06
8.2.210.0040.00426.77
8.2.200.0090.00016.50
8.2.190.0120.00916.75
8.2.180.0070.00716.32
8.2.170.0180.00018.89
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0050.00321.00
8.2.110.0100.00019.19
8.2.100.0090.00317.97
8.2.90.0070.00419.17
8.2.80.0060.00318.14
8.2.70.0000.00817.93
8.2.60.0130.00417.13
8.2.50.0170.00317.34
8.2.40.0110.00517.25
8.2.30.0090.00917.47
8.2.20.0130.00717.49
8.2.10.0190.00017.38
8.2.00.0140.00417.35
8.1.330.0110.00816.34
8.1.320.0100.00918.21
8.1.310.0120.00618.29
8.1.300.0050.00319.54
8.1.290.0050.00530.84
8.1.280.0100.00725.92
8.1.270.0090.00023.84
8.1.260.0000.00726.35
8.1.250.0160.00028.09
8.1.240.0000.01117.48
8.1.230.0090.00317.77
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0060.00317.13
8.1.180.0130.00516.88
8.1.170.0030.01617.13
8.1.160.0160.00017.00
8.1.150.0120.00616.88
8.1.140.0050.01117.25
8.1.130.0110.00516.88
8.1.120.0140.00317.13
8.1.110.0110.00717.50
8.1.100.0140.00317.13
8.1.90.0090.00917.00
8.1.80.0180.00017.25
8.1.70.0190.00817.00
8.1.60.0140.00517.37
8.1.50.0100.01017.13
8.1.40.0150.00417.38
8.1.30.0140.00417.22
8.1.20.0110.00717.13
8.1.10.0120.00616.97
8.1.00.0120.00517.00
8.0.300.0040.00818.77
8.0.290.0060.00616.75
8.0.280.0100.00616.63
8.0.270.0080.00816.52
8.0.260.0140.00316.52
8.0.250.0110.00616.52
8.0.240.0140.00616.63
8.0.230.0170.00016.59
8.0.220.0150.00216.52
8.0.210.0080.00816.59
8.0.200.0090.00916.74
8.0.190.0160.00016.52
8.0.180.0160.00316.63
8.0.170.0120.00416.59
8.0.160.0140.00416.52
8.0.150.0100.00516.63
8.0.140.0140.00516.63
8.0.130.0160.00016.52
8.0.120.0110.00716.52
8.0.110.0100.00516.62
8.0.100.0080.00816.52
8.0.90.0110.00516.63
8.0.80.0130.00316.52
8.0.70.0120.00416.52
8.0.60.0100.00716.52
8.0.50.0150.00216.52
8.0.30.0070.01116.52
8.0.20.0060.00916.63
8.0.10.0080.00816.52

preferences:
43.89 ms | 403 KiB | 5 Q