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.0120.00316.38
8.3.60.0090.00916.50
8.3.50.0070.00916.61
8.3.40.0000.01419.02
8.3.30.0040.01118.67
8.3.20.0140.00021.86
8.3.10.0060.00323.52
8.3.00.0080.00018.16
8.2.190.0160.00618.16
8.2.180.0070.01118.29
8.2.170.0070.00722.96
8.2.160.0130.00021.11
8.2.150.0070.00024.18
8.2.140.0070.00024.66
8.2.130.0000.00920.43
8.2.120.0060.00326.35
8.2.110.0030.00621.18
8.2.100.0030.00917.91
8.2.90.0000.00819.17
8.2.80.0040.00418.05
8.2.70.0000.00817.84
8.2.60.0050.00318.05
8.2.50.0090.00018.18
8.2.40.0060.00320.59
8.2.30.0030.00519.25
8.2.20.0000.00718.24
8.2.10.0040.00418.15
8.2.00.0040.00418.11
8.1.280.0170.00325.92
8.1.270.0040.01123.88
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0050.00524.00
8.1.230.0030.00719.28
8.1.220.0000.00817.79
8.1.210.0050.00318.77
8.1.200.0090.00017.48
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0040.00418.70
8.1.160.0030.00518.90
8.1.150.0080.00020.20
8.1.140.0000.00719.60
8.1.130.0000.00718.86
8.1.120.0030.00417.52
8.1.110.0000.00717.50
8.1.100.0040.00417.57
8.1.90.0040.00417.51
8.1.80.0030.00417.42
8.1.70.0000.00717.44
8.1.60.0040.00417.69
8.1.50.0050.00317.57
8.1.40.0030.00617.54
8.1.30.0040.00417.61
8.1.20.0000.00817.57
8.1.10.0000.00717.62
8.1.00.0000.00717.50
8.0.300.0030.00320.25
8.0.290.0060.00316.88
8.0.280.0000.00718.57
8.0.270.0070.00017.25
8.0.260.0000.00716.89
8.0.250.0000.00716.93
8.0.240.0030.00316.92
8.0.230.0000.00716.94
8.0.220.0030.00317.00
8.0.210.0040.00416.96
8.0.200.0060.00017.02
8.0.190.0040.00416.88
8.0.180.0000.00716.86
8.0.170.0070.00017.04
8.0.160.0030.00316.81
8.0.150.0070.00016.80
8.0.140.0040.00416.90
8.0.130.0050.00013.39
8.0.120.0000.00716.91
8.0.110.0040.00416.81
8.0.100.0040.00416.93
8.0.90.0050.00316.89
8.0.80.0090.01216.93
8.0.70.0030.00516.91
8.0.60.0070.00016.84
8.0.50.0040.00416.76
8.0.30.0110.00517.10
8.0.20.0100.01117.42
8.0.10.0040.00416.95
8.0.00.0130.00316.99
7.4.330.0020.00215.55
7.4.320.0000.00616.61
7.4.300.0030.00316.55
7.4.290.0000.00816.45
7.4.280.0080.00016.48
7.4.270.0070.00016.59
7.4.260.0070.00013.34
7.4.250.0040.00416.38
7.4.240.0040.00416.59
7.4.230.0030.00316.56
7.4.220.0090.00916.50
7.4.210.0070.00716.59
7.4.200.0000.00716.68
7.4.160.0060.01216.37
7.4.150.0080.00917.40
7.4.140.0120.00917.86
7.4.130.0120.00916.46
7.4.120.0110.00816.60
7.4.110.0070.01216.60
7.4.100.0100.00616.53
7.4.90.0130.00316.50
7.4.80.0030.01419.39
7.4.70.0000.01716.45
7.4.60.0070.01016.59
7.4.50.0030.01316.67
7.4.40.0080.00816.48
7.4.30.0090.00616.52
7.4.10.0070.01014.70
7.4.00.0050.01314.79
7.3.330.0030.00313.18
7.3.320.0030.00313.32
7.3.310.0030.00316.38
7.3.300.0000.00716.42
7.3.290.0060.00916.39
7.3.280.0090.00816.38
7.3.270.0060.01017.40
7.3.260.0070.01016.46
7.3.250.0140.00716.43
7.3.240.0080.01216.37
7.3.230.0100.00716.55
7.3.210.0080.00816.44
7.3.200.0030.02016.38
7.3.190.0150.00716.46
7.3.180.0100.00716.55
7.3.170.0080.00816.48
7.3.160.0060.01016.80
7.3.130.0090.00914.86
7.3.120.0060.01314.92
7.3.110.0060.01214.91
7.3.100.0060.00614.84
7.3.90.0040.01115.09
7.3.80.0100.00714.80
7.3.70.0060.00314.89
7.3.60.0130.00314.85
7.3.50.0030.00614.75
7.3.40.0040.00814.82
7.3.30.0080.00614.79
7.3.20.0040.00916.69
7.3.10.0030.01316.55
7.3.00.0110.00016.70
7.2.330.0110.01116.51
7.2.320.0100.00716.83
7.2.310.0090.00616.88
7.2.300.0060.01716.72
7.2.290.0080.00816.73
7.2.260.0000.01915.26
7.2.250.0070.01115.00
7.2.240.0060.01114.72
7.2.230.0070.01115.02
7.2.220.0080.00414.92
7.2.210.0080.00414.82
7.2.200.0040.00415.12
7.2.190.0030.01415.07
7.2.180.0040.00414.94
7.2.170.0000.01414.91
7.2.160.0120.00615.09
7.2.150.0080.00816.91
7.2.140.0060.00616.81
7.2.130.0090.00317.00
7.2.120.0030.01316.98
7.2.110.0000.01217.07
7.2.100.0070.01117.04
7.2.90.0030.00716.77
7.2.80.0080.00416.81
7.2.70.0000.00917.10
7.2.60.0050.00817.03
7.2.50.0040.00816.86
7.2.40.0000.01316.96
7.2.30.0040.01117.14
7.2.20.0000.01216.91
7.2.10.0070.00717.11
7.2.00.0030.01016.96
7.1.330.0100.00615.78
7.1.320.0100.01015.93
7.1.310.0030.01016.00
7.1.300.0090.00315.70
7.1.290.0060.00315.78
7.1.280.0060.00615.66
7.1.270.0060.00615.74
7.1.260.0040.01116.01
7.1.250.0040.00815.91
7.1.240.0060.00315.86
7.1.230.0000.01115.88
7.1.220.0070.00715.84
7.1.210.0060.00315.70
7.1.200.0040.00715.83
7.1.190.0000.00815.85
7.1.180.0070.00716.01
7.1.170.0000.00915.93
7.1.160.0060.00915.92
7.1.150.0100.00315.95
7.1.140.0060.00315.98
7.1.130.0030.01015.86
7.1.120.0090.00315.76
7.1.110.0030.01015.96
7.1.100.0090.00316.02
7.1.90.0030.00915.84
7.1.80.0040.00715.56
7.1.70.0000.01016.63
7.1.60.0480.00524.40
7.1.50.0560.01024.29
7.1.40.0570.01724.25
7.1.30.0670.01024.28
7.1.20.0750.01024.05
7.1.10.0400.00815.22
7.1.00.0700.00915.33
7.0.330.0130.00015.27
7.0.320.0030.00615.29
7.0.310.0000.01015.48
7.0.300.0000.01015.45
7.0.290.0090.00315.47
7.0.280.0040.00915.24
7.0.270.0050.00315.62
7.0.260.0030.00615.46
7.0.250.0040.00815.38
7.0.240.0070.01015.54
7.0.230.0030.01115.45
7.0.220.0040.00815.34
7.0.210.0030.01315.61
7.0.200.0480.01215.31
7.0.190.0650.00515.13
7.0.180.0430.00914.90
7.0.170.0690.00514.96
7.0.160.0970.00914.97
7.0.150.0430.00915.05
7.0.140.0480.00615.05
7.0.130.0580.01115.21
7.0.120.0590.00815.02
7.0.110.0520.01015.01
7.0.100.0440.00314.97
7.0.90.0480.00714.85
7.0.80.0570.01115.10
7.0.70.0520.00614.98
7.0.60.0600.00814.91
7.0.50.0480.00815.07
7.0.40.0400.01014.10
7.0.30.0320.01113.95
7.0.20.0670.01213.98
7.0.10.0500.01313.97
7.0.00.0640.00914.07
5.6.400.0040.00814.72
5.6.390.0070.00714.33
5.6.380.0080.00014.39
5.6.370.0030.00614.47
5.6.360.0030.00914.37
5.6.350.0030.01214.68
5.6.340.0040.00414.75
5.6.330.0060.00614.14
5.6.320.0060.00914.61
5.6.310.0060.00314.38
5.6.300.0000.00914.40
5.6.290.0000.01314.19
5.6.280.0030.00914.90
5.6.270.0000.01314.47
5.6.260.0110.00314.72
5.6.250.0040.00714.48
5.6.240.0060.01014.40
5.6.230.0030.01014.32
5.6.220.0030.00914.20
5.6.210.0070.00714.50
5.6.200.0040.00814.37
5.6.190.0060.00614.46
5.6.180.0090.00314.41
5.6.170.0090.00614.48
5.6.160.0060.00614.40
5.6.150.0150.00014.46
5.6.140.0050.00314.29
5.6.130.0070.00714.47
5.6.120.0000.01214.48
5.6.110.0040.00714.31
5.6.100.0000.01114.28
5.6.90.0030.01014.13
5.6.80.0000.01414.54
5.6.70.0000.01514.16
5.6.60.0060.01014.49
5.6.50.0060.00914.29
5.6.40.0140.00314.64
5.6.30.0080.00614.13
5.6.20.0080.00414.64
5.6.10.0090.00314.20
5.6.00.0060.00614.34

preferences:
31.25 ms | 401 KiB | 5 Q