3v4l.org

run code in 300+ PHP versions simultaneously
<?php $colors = array ('red','blue','green','yellow'); $boxes = array ('circular','squared','hexagonal','triangular'); $possible_combos = array ( array('circular','red','blue'), array('squared','red','green'), array('hexagonal','blue','yellow'), array('triangular','red','green') ); // collect constraints ordered by rarest foreach ($possible_combos as $constraint) { $box = array_shift($constraint); foreach ($constraint as $color) { $constraints[$color] []= $box; } } // assign rarest first to last asort($constraints); foreach ($constraints as $color => $allowedBoxes) { foreach ($allowedBoxes as $box) { $key = array_search($box, $boxes); // if we have a match, then remove it from the collection if ($key !== false) { $result[$box] = $color; unset($boxes[$key]); continue 2; } } } print_r($result);

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.4.130.0110.00918.55
8.4.120.0100.01023.91
8.4.110.0110.00920.55
8.4.100.0110.01017.83
8.4.90.0060.00518.59
8.4.80.0080.00717.93
8.4.70.0050.01418.98
8.4.60.0140.00718.93
8.4.50.0110.01020.42
8.4.40.0170.00319.37
8.4.30.0130.00719.14
8.4.20.0090.01220.48
8.4.10.0130.00317.80
8.3.260.0050.00516.65
8.3.250.0100.00818.96
8.3.240.0110.00817.07
8.3.230.0090.00916.61
8.3.220.0100.00717.28
8.3.210.0110.00416.65
8.3.200.0040.00516.45
8.3.190.0090.00617.17
8.3.180.0120.00518.21
8.3.170.0060.01317.35
8.3.160.0040.00420.01
8.3.150.0040.01416.61
8.3.140.0000.00917.36
8.3.130.0090.00016.54
8.3.120.0030.00618.91
8.3.110.0060.00320.94
8.3.100.0110.00724.06
8.3.90.0100.01026.77
8.3.80.0050.00516.63
8.3.70.0090.00618.68
8.3.60.0080.00818.55
8.3.50.0110.00618.43
8.3.40.0070.01418.77
8.3.30.0160.00318.55
8.3.20.0040.00421.94
8.3.10.0040.00421.84
8.3.00.0040.00419.81
8.2.290.0110.00820.48
8.2.280.0080.00718.19
8.2.270.0130.00317.31
8.2.260.0100.00719.01
8.2.250.0000.00816.71
8.2.240.0040.00419.22
8.2.230.0000.00722.58
8.2.220.0060.00337.54
8.2.210.0150.00426.77
8.2.200.0030.00716.63
8.2.190.0060.01016.58
8.2.180.0120.00318.41
8.2.170.0070.00722.96
8.2.160.0030.01021.19
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0060.00326.16
8.2.120.0080.00019.79
8.2.110.0070.00321.06
8.2.100.0030.00917.78
8.2.90.0030.00520.59
8.2.80.0040.00417.97
8.2.70.0030.00617.93
8.2.60.0000.00818.04
8.2.50.0080.00418.10
8.2.40.0040.00420.44
8.2.30.0000.00819.34
8.2.20.0000.00818.13
8.2.10.0040.00418.04
8.2.00.0040.00418.07
8.1.330.0080.01021.92
8.1.320.0140.00616.42
8.1.310.0040.00418.35
8.1.300.0150.00018.05
8.1.290.0060.00318.88
8.1.280.0040.01825.92
8.1.270.0040.00422.06
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00619.44
8.1.230.0040.00720.86
8.1.220.0060.00317.79
8.1.210.0060.00318.88
8.1.200.0030.00517.22
8.1.190.0080.00017.13
8.1.180.0000.00718.10
8.1.170.0080.00018.62
8.1.160.0040.00418.92
8.1.150.0040.00419.11
8.1.140.0040.00417.61
8.1.130.0040.00418.95
8.1.120.0030.00317.52
8.1.110.0040.00417.45
8.1.100.0060.00317.47
8.1.90.0070.00017.41
8.1.80.0110.00017.46
8.1.70.0080.00017.49
8.1.60.0000.00817.66
8.1.50.0040.00717.51
8.1.40.0060.00317.59
8.1.30.0030.00517.58
8.1.20.0040.00417.66
8.1.10.0040.00417.64
8.1.00.0000.00817.53
8.0.300.0070.00020.09
8.0.290.0050.00316.75
8.0.280.0000.00718.38
8.0.270.0040.00417.29
8.0.260.0040.00417.29
8.0.250.0030.00316.95
8.0.240.0070.00016.86
8.0.230.0030.00317.01
8.0.220.0070.00016.78
8.0.210.0000.00716.79
8.0.200.0040.00417.05
8.0.190.0000.00816.95
8.0.180.0000.00716.96
8.0.170.0060.00316.95
8.0.160.0040.00416.90
8.0.150.0040.00416.94
8.0.140.0080.00016.78
8.0.130.0030.00313.32
8.0.120.0080.00016.91
8.0.110.0000.00716.94
8.0.100.0030.00516.96
8.0.90.0040.00416.80
8.0.80.0090.00616.87
8.0.70.0040.00416.71
8.0.60.0060.00316.81
8.0.50.0040.00416.88
8.0.30.0110.00917.06
8.0.20.0150.00317.40
8.0.10.0070.00016.84
8.0.00.0090.00916.66
7.4.330.0030.00315.55
7.4.320.0070.00016.53
7.4.300.0000.00616.51
7.4.290.0050.00316.56
7.4.280.0050.00316.67
7.4.270.0030.00316.68
7.4.260.0000.00716.64
7.4.250.0040.00416.62
7.4.240.0000.00716.59
7.4.230.0000.00716.63
7.4.220.0040.00416.49
7.4.210.0060.01216.69
7.4.200.0000.00716.51
7.4.160.0080.00816.54
7.4.140.0090.01017.86
7.4.130.0100.00616.33
7.4.120.0120.00616.55
7.4.110.0030.01316.46
7.4.100.0090.00916.48
7.4.90.0160.00616.56
7.4.80.0130.01019.39
7.4.70.0100.00716.52
7.4.60.0130.00316.53
7.4.50.0040.01116.32
7.4.40.0060.01016.56
7.4.00.0030.01114.97
7.3.330.0000.00513.19
7.3.320.0030.00313.23
7.3.310.0080.00016.21
7.3.300.0000.00616.31
7.3.290.0030.00316.27
7.3.280.0130.00416.33
7.3.260.0070.00916.52
7.3.240.0100.00916.35
7.3.230.0070.01016.32
7.3.210.0140.00416.46
7.3.200.0090.00916.45
7.3.190.0110.00516.67
7.3.180.0120.00916.39
7.3.170.0060.00916.47
7.3.160.0100.00616.40
7.2.330.0180.00616.80
7.2.320.0140.00816.72
7.2.310.0120.00916.80
7.2.300.0120.00616.88
7.2.290.0140.00316.73
7.2.60.0070.01017.05
7.2.50.0160.00317.01
7.2.40.0570.00818.19
7.2.30.0450.01418.12
7.2.20.1190.01418.09
7.2.10.0560.01217.92
7.2.00.0360.01218.00
7.1.200.0030.00915.97
7.1.160.0460.01216.96
7.1.150.0450.01217.00
7.1.140.0520.01217.20
7.1.130.0540.00816.98
7.1.120.0360.01116.82
7.1.110.0500.01216.54
7.1.100.0760.01416.42
7.1.90.0500.01115.98
7.1.80.0490.01116.33
7.1.70.0510.01015.35
7.1.60.0810.01333.03
7.1.50.0770.01133.17
7.1.40.0740.01832.59
7.1.30.0740.02232.54
7.1.20.0830.01532.63
7.1.10.0840.01414.82
7.1.00.0430.01114.77

preferences:
29.75 ms | 403 KiB | 5 Q