3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total_capacity = 100; $resources = array('gold'=>125,'stone'=>30, 'food'=>0); $loot = array(); asort($resources); foreach($resources as $type => $resource) { $max = floor(($total_capacity-array_sum($loot))/(3-count($loot))); // var_dump(count($loot)); if($max > $resource) { $loot[$type] = $resource; } else { $loot[$type] = $max; } } print_r($loot); ?>

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.70.0130.00316.63
8.3.60.0080.01118.43
8.3.50.0140.00916.51
8.3.40.0080.00819.02
8.3.30.0090.00618.88
8.3.20.0070.00721.57
8.3.10.0000.00823.72
8.3.00.0000.00817.88
8.2.180.0140.00418.20
8.2.170.0120.00322.96
8.2.160.0030.01321.32
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00420.47
8.2.120.0040.00426.35
8.2.110.0080.00321.17
8.2.100.0070.00418.03
8.2.90.0040.00419.30
8.2.80.0050.00318.05
8.2.70.0040.00417.75
8.2.60.0060.00317.93
8.2.50.0000.00818.15
8.2.40.0000.00820.58
8.2.30.0030.00619.29
8.2.20.0000.00718.15
8.2.10.0000.00818.05
8.2.00.0040.00418.10
8.1.280.0140.00725.92
8.1.270.0030.01023.96
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0040.00424.05
8.1.230.0070.00419.22
8.1.220.0030.00517.77
8.1.210.0000.00918.77
8.1.200.0060.00317.48
8.1.190.0050.00317.25
8.1.180.0000.00818.10
8.1.170.0030.00618.49
8.1.160.0070.00018.94
8.1.150.0000.00720.19
8.1.140.0040.00419.70
8.1.130.0040.00419.00
8.1.120.0040.00417.55
8.1.110.0000.00817.42
8.1.100.0040.00417.55
8.1.90.0000.00717.47
8.1.80.0070.00017.54
8.1.70.0030.00317.54
8.1.60.0000.00817.63
8.1.50.0040.00417.59
8.1.40.0030.00617.49
8.1.30.0040.00417.56
8.1.20.0040.00417.70
8.1.10.0040.00417.55
8.1.00.0000.00717.55
8.0.300.0020.00520.21
8.0.290.0060.00316.75
8.0.280.0000.00718.42
8.0.270.0030.00317.25
8.0.260.0040.00416.88
8.0.250.0070.00016.93
8.0.240.0000.00716.93
8.0.230.0040.00416.91
8.0.220.0070.00016.86
8.0.210.0000.00716.93
8.0.200.0070.00016.99
8.0.190.0080.00016.98
8.0.180.0040.00416.83
8.0.170.0030.00316.93
8.0.160.0040.00317.05
8.0.150.0000.00716.98
8.0.140.0040.00316.80
8.0.130.0000.00513.37
8.0.120.0030.00516.88
8.0.110.0050.00216.75
8.0.100.0040.00416.90
8.0.90.0000.00816.93
8.0.80.0230.01316.96
8.0.70.0000.00716.84
8.0.60.0000.00716.97
8.0.50.0040.00416.98
8.0.30.0100.00717.14
8.0.20.0110.01117.43
8.0.10.0090.00017.05
8.0.00.0150.00716.70
7.4.330.0020.00215.55
7.4.320.0000.00616.52
7.4.300.0000.00616.47
7.4.290.0000.00716.68
7.4.280.0000.00716.68
7.4.270.0040.00416.43
7.4.260.0050.00313.31
7.4.250.0000.00716.38
7.4.240.0000.00716.67
7.4.230.0000.00716.36
7.4.220.0090.01016.68
7.4.210.0170.01016.65
7.4.200.0030.00316.31
7.4.160.0060.01216.53
7.4.150.0130.00617.40
7.4.140.0090.01017.86
7.4.130.0090.01116.69
7.4.120.0120.00716.51
7.4.110.0000.01716.85
7.4.100.0200.00316.46
7.4.90.0090.00916.50
7.4.80.0160.00019.39
7.4.70.0120.00416.58
7.4.60.0140.00316.57
7.4.50.0030.01016.47
7.4.40.0110.00516.50
7.4.30.0130.00316.59
7.4.00.0110.00514.88
7.3.330.0030.00313.29
7.3.320.0000.00513.26
7.3.310.0000.00716.20
7.3.300.0030.00316.25
7.3.290.0060.00816.42
7.3.280.0070.00916.37
7.3.270.0100.00717.40
7.3.260.0110.00716.29
7.3.250.0100.01016.43
7.3.240.0130.00616.35
7.3.230.0100.01416.49
7.3.210.0030.01316.37
7.3.200.0140.00716.71
7.3.190.0100.00616.41
7.3.180.0080.00816.42
7.3.170.0140.00316.42
7.3.160.0080.00816.45
7.3.120.0080.00714.63
7.3.110.0070.01115.09
7.3.100.0130.00514.59
7.3.90.0090.00915.00
7.3.80.0030.01014.87
7.3.70.0060.01114.66
7.3.60.0060.00814.84
7.3.50.0080.00814.99
7.3.40.0060.00714.91
7.3.30.0030.01214.81
7.3.20.0090.00516.45
7.3.10.0110.00316.64
7.3.00.0050.01116.70
7.2.330.0130.00616.48
7.2.320.0030.01516.83
7.2.310.0100.00616.54
7.2.300.0070.01316.82
7.2.290.0060.01116.57
7.2.250.0060.01314.97
7.2.240.0050.01115.10
7.2.230.0000.01515.19
7.2.220.0050.01114.95
7.2.210.0110.00615.05
7.2.200.0050.01115.00
7.2.190.0070.00915.00
7.2.180.0050.00515.14
7.2.170.0080.00815.01
7.2.60.0060.00616.78
7.2.00.0070.01419.50
7.1.330.0020.01315.92
7.1.320.0090.00515.80
7.1.310.0080.00615.81
7.1.300.0100.00615.88
7.1.290.0050.00915.68
7.1.280.0050.00915.65
7.1.270.0050.00715.78
7.1.260.0130.00215.86
7.1.200.0030.01015.54
7.1.100.0040.00817.79
7.1.70.0100.00717.32
7.1.60.0870.01333.08
7.1.50.0730.01732.93
7.1.40.0770.01332.73
7.1.30.0930.01332.61
7.1.20.0800.01332.62
7.1.10.0870.01714.86
7.1.00.0770.01014.73
7.0.200.0700.01014.96
7.0.190.1100.01315.07
7.0.180.0600.01314.36
7.0.170.1500.00714.34
7.0.160.0700.01014.45
7.0.150.0970.00714.32
7.0.140.1030.01314.43
7.0.130.0670.01014.77
7.0.120.0730.01014.94
7.0.110.0930.01014.41
7.0.100.0700.01314.57
7.0.90.0730.01314.55
7.0.80.0730.00714.46
7.0.70.0800.00314.41
7.0.60.1000.01014.37
7.0.50.0730.00714.45
7.0.40.0730.00714.68
7.0.30.0770.01014.70
7.0.20.0730.01014.34
7.0.10.0770.01014.53
7.0.00.1230.01014.37

preferences:
79.76 ms | 401 KiB | 5 Q