3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weights = [1, 100, 111, 168, 569, 1652, 16549, 19999, 20000, 20001, 25649, 35216, 54961]; foreach($weights as $index => $weight) { $extra_weight = round($weight-20000, 3)/1000; $extra_cost = $extra_weight * 1.00; echo "Method 1: Weight= $weight , Extra Weight: $extra_weight \n"; echo "Method 1: Weight= $weight , Extra Cost: $extra_weight \n"; $extra_weight = round((($weight-20000)/1000), -3); $extra_cost = $extra_weight * 1.00; echo "Method 2: Weight= $weight , Extra Weight: $extra_weight \n"; echo "Method 2: Weight= $weight , Extra Cost: $extra_weight \n"; } ?>

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.40.0160.00018.81
8.3.30.0030.01019.05
8.3.20.0000.00720.35
8.3.10.0030.00523.64
8.3.00.0060.00319.26
8.2.170.0000.01522.96
8.2.160.0040.01120.38
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0110.00322.23
8.2.110.0070.00321.16
8.2.100.0040.00717.84
8.2.90.0080.00019.19
8.2.80.0050.00317.97
8.2.70.0000.00817.75
8.2.60.0040.00417.93
8.2.50.0080.00018.10
8.2.40.0040.00420.01
8.2.30.0040.00418.11
8.2.20.0000.00717.73
8.2.10.0020.00518.07
8.2.00.0040.00417.68
8.1.270.0080.00022.14
8.1.260.0090.00026.35
8.1.250.0050.00328.09
8.1.240.0070.00322.18
8.1.230.0030.00717.82
8.1.220.0050.00317.79
8.1.210.0050.00318.77
8.1.200.0040.00417.48
8.1.190.0030.00517.35
8.1.180.0000.00918.10
8.1.170.0030.00518.78
8.1.160.0040.00422.12
8.1.150.0040.00418.82
8.1.140.0020.00517.42
8.1.130.0030.00317.75
8.1.120.0000.00717.56
8.1.110.0040.00417.52
8.1.100.0000.00717.52
8.1.90.0000.00817.44
8.1.80.0000.00717.42
8.1.70.0030.00317.47
8.1.60.0000.00917.67
8.1.50.0030.00617.60
8.1.40.0040.00417.50
8.1.30.0000.00817.63
8.1.20.0040.00417.66
8.1.10.0040.00417.55
8.1.00.0040.00417.52
8.0.300.0030.00618.77
8.0.290.0040.00416.75
8.0.280.0000.00718.48
8.0.270.0070.00017.32
8.0.260.0030.00517.20
8.0.250.0080.00016.92
8.0.240.0030.00317.09
8.0.230.0000.00816.88
8.0.220.0000.00716.89
8.0.210.0030.00316.87
8.0.200.0030.00316.91
8.0.190.0040.00416.91
8.0.180.0000.00716.96
8.0.170.0080.00016.86
8.0.160.0000.00717.02
8.0.150.0000.00716.90
8.0.140.0050.00216.91
8.0.130.0000.00613.45
8.0.120.0060.00316.98
8.0.110.0000.00716.79
8.0.100.0040.00416.85
8.0.90.0000.00816.91
8.0.80.0100.01016.93
8.0.70.0040.00416.90
8.0.60.0000.00716.80
8.0.50.0050.00216.89
8.0.30.0070.01217.01
8.0.20.0130.01017.40
8.0.10.0080.00016.97
8.0.00.0090.01116.76
7.4.330.0050.00015.18
7.4.320.0060.00016.57
7.4.300.0000.00616.68
7.4.290.0050.00316.46
7.4.280.0060.00616.50
7.4.270.0030.00316.71
7.4.260.0070.00416.54
7.4.250.0000.00716.59
7.4.240.0030.00516.52
7.4.230.0070.00016.49
7.4.220.0090.01016.63
7.4.210.0090.01216.52
7.4.200.0040.00416.74
7.4.160.0040.01316.64
7.4.150.0130.01317.40
7.4.140.0150.01017.86
7.4.130.0110.00816.46
7.4.120.0100.01016.65
7.4.110.0100.00716.47
7.4.100.0140.00516.52
7.4.90.0030.01316.64
7.4.80.0070.01019.39
7.4.70.0180.00616.65
7.4.60.0080.01216.60
7.4.50.0040.00416.58
7.4.40.0070.01116.37
7.4.30.0070.01116.47
7.4.00.0070.00914.98
7.3.330.0000.00513.33
7.3.320.0050.00013.43
7.3.310.0030.00316.41
7.3.300.0040.00416.46
7.3.290.0030.01216.50
7.3.280.0070.01316.45
7.3.270.0100.01117.40
7.3.260.0040.01716.66
7.3.250.0110.00816.65
7.3.240.0100.00716.50
7.3.230.0060.01116.44
7.3.210.0090.00916.43
7.3.200.0000.02419.39
7.3.190.0090.01216.61
7.3.180.0100.01016.73
7.3.170.0110.00616.65
7.3.160.0100.00716.43
7.3.120.0090.00614.77
7.3.110.0060.00914.88
7.3.100.0030.01014.82
7.3.90.0000.01114.93
7.3.80.0080.00814.57
7.3.70.0100.00414.97
7.3.60.0060.00814.86
7.3.50.0060.01014.61
7.3.40.0070.00714.86
7.3.30.0070.00714.71
7.3.20.0000.00916.79
7.3.10.0100.00316.79
7.3.00.0050.00816.62
7.2.330.0060.01516.85
7.2.320.0030.01716.79
7.2.310.0080.00816.93
7.2.300.0090.00916.73
7.2.290.0120.01216.76
7.2.250.0040.01415.14
7.2.240.0070.01115.08
7.2.230.0070.01014.84
7.2.220.0080.00614.95
7.2.210.0110.00314.92
7.2.200.0070.00714.85
7.2.190.0070.00415.16
7.2.180.0060.01015.16
7.2.170.0090.00615.01
7.2.130.0030.01316.90
7.2.120.0070.00317.09
7.2.110.0200.00317.02
7.2.100.0090.00616.83
7.2.90.0040.01216.85
7.2.80.0000.01316.98
7.2.70.0030.00616.94
7.2.60.0060.00617.02
7.2.50.0120.00317.00
7.2.40.0070.00716.89
7.2.30.0030.00716.96
7.2.20.0080.00416.82
7.2.10.0040.01216.72
7.2.00.0090.01018.17
7.1.330.0100.00315.79
7.1.320.0000.01115.52
7.1.310.0040.01116.01
7.1.300.0080.00816.05
7.1.290.0070.01015.95
7.1.280.0000.01415.70
7.1.270.0000.01015.67
7.1.260.0100.00315.90
7.1.250.0060.00616.01
7.1.240.0050.00515.82
7.1.230.0040.00415.51
7.1.220.0030.01015.76
7.1.210.0000.00915.57
7.1.200.0060.00615.72
7.1.190.0120.00015.78
7.1.180.0110.00415.84
7.1.170.0070.00315.95
7.1.160.0080.00416.02
7.1.150.0000.01415.81
7.1.140.0090.00615.98
7.1.130.0040.00715.87
7.1.120.0030.01115.76
7.1.110.0070.00715.98
7.1.100.0070.00516.90
7.1.90.0060.00615.54
7.1.80.0080.00815.82
7.1.70.0060.00516.57
7.1.60.0120.00717.47
7.1.50.0080.00616.21
7.1.40.0100.00015.71
7.1.30.0060.00315.64
7.1.20.0030.00715.84
7.1.10.0060.00615.72
7.1.00.0040.04419.21
7.0.330.0210.00315.43
7.0.320.0000.01615.47
7.0.310.0000.00815.42
7.0.300.0040.00415.30
7.0.290.0070.00715.43
7.0.280.0080.00615.38
7.0.270.0040.00815.55
7.0.260.0070.00415.23
7.0.250.0000.01315.51
7.0.240.0040.00915.32
7.0.230.0030.01015.30
7.0.220.0030.00915.50
7.0.210.0040.00415.54
7.0.200.0030.01016.16
7.0.190.0100.00315.46
7.0.180.0000.01415.38
7.0.170.0070.00315.53
7.0.160.0030.01015.60
7.0.150.0000.00815.61
7.0.140.0000.04518.79
7.0.130.0040.00815.18
7.0.120.0110.00015.34
7.0.110.0110.00415.46
7.0.100.0080.00415.52
7.0.90.0080.00415.56
7.0.80.0040.00415.48
7.0.70.0000.01115.06
7.0.60.0060.02517.80
7.0.50.0090.02516.79
7.0.40.0080.04616.71
7.0.30.0170.04716.83
7.0.20.0150.03816.82
7.0.10.0030.02616.72
7.0.00.0070.04916.76
5.6.380.0040.00414.48
5.6.370.0030.01014.32
5.6.360.0000.01514.27
5.6.350.0040.01114.43
5.6.340.0060.00614.02
5.6.330.0100.00314.18
5.6.320.0000.01414.47
5.6.310.0070.00414.43
5.6.300.0060.01014.32
5.6.290.0090.00014.32
5.6.280.0080.03517.82
5.6.270.0040.00714.60
5.6.260.0000.01414.41
5.6.250.0150.00314.20
5.6.240.0070.00714.16
5.6.230.0060.00614.00
5.6.220.0070.00314.43
5.6.210.0100.02517.64
5.6.200.0080.02716.40
5.6.190.0080.03317.57
5.6.180.0140.04317.40
5.6.170.0230.03917.32
5.6.160.0100.02317.45
5.6.150.0150.02316.24
5.6.140.0050.04016.41
5.6.130.0120.04316.31
5.6.120.0160.04317.81
5.6.110.0100.04517.79
5.6.100.0170.04017.80
5.6.90.0100.04217.69
5.6.80.0070.04017.36
5.6.70.0030.01014.43
5.6.60.0140.00314.20
5.6.50.0100.00713.98
5.6.40.0000.01314.29
5.6.30.0070.01014.30
5.6.20.0070.01014.31
5.6.10.0080.00814.11
5.6.00.0140.00314.23
5.5.380.0060.00010.98
5.5.370.0040.00810.74
5.5.360.0130.00511.40
5.5.350.2160.02515.70
5.5.340.0070.02214.53
5.5.330.0080.02215.89
5.5.320.0200.03915.71
5.5.310.0190.04615.78
5.5.300.0100.04014.56
5.5.290.0100.04014.48
5.5.280.0050.02516.33
5.5.270.0030.04015.93
5.5.260.0120.03816.02
5.5.250.0030.04815.77
5.5.240.0150.04015.70
5.5.230.0090.00311.12
5.5.220.0000.00610.86
5.5.210.0000.00810.86
5.5.200.0090.00011.13
5.5.190.0060.01010.61
5.5.180.0080.00410.67
5.5.170.0060.00310.89
5.5.160.0070.00010.53
5.5.150.0150.00010.81
5.5.140.0140.00310.77
5.5.130.0040.00410.81
5.5.120.0080.00410.80
5.5.110.0080.00810.94
5.5.100.0060.00610.97
5.5.90.0090.00310.93
5.5.80.0070.00710.88
5.5.70.0030.00910.77
5.5.60.0040.00410.91
5.5.50.0100.00310.73
5.5.40.0060.00811.24
5.5.30.0060.00010.82
5.5.20.0080.00411.13
5.5.10.0140.00310.96
5.5.00.0060.00611.09
5.4.450.0410.03715.27
5.4.440.0300.02715.41
5.4.430.0360.03215.31
5.4.420.0420.00415.14
5.4.410.0380.00215.07
5.4.400.0330.00615.16
5.4.390.0380.00215.18
5.4.380.0340.00314.96
5.4.370.0320.00614.92
5.4.360.0320.00515.01
5.4.350.0330.00515.08
5.4.340.0070.02311.39
5.4.330.0100.00711.08
5.4.320.0070.02811.67
5.4.310.0070.02611.86
5.4.300.0070.02011.72
5.4.290.0020.02611.57
5.4.280.0100.01811.72
5.4.270.0060.02111.60
5.4.260.0070.02111.63
5.4.250.0090.02111.50
5.4.240.0050.02411.58
5.4.230.0070.02411.41
5.4.220.0040.02311.56
5.4.210.0060.02011.68
5.4.200.0110.01811.42
5.4.190.0050.02311.45
5.4.180.0060.02011.51
5.4.170.0060.02011.57
5.4.160.0040.02411.60
5.4.150.0060.02211.46
5.4.140.0020.02611.43
5.4.130.0110.02611.39
5.4.120.0090.01811.34
5.4.110.0060.01911.29
5.4.100.0050.02311.36
5.4.90.0080.02111.26
5.4.80.0040.02711.28
5.4.70.0090.01811.34
5.4.60.0070.02111.37
5.4.50.0040.02311.39
5.4.40.0080.02611.35
5.4.30.0050.03011.46
5.4.20.0040.03011.31
5.4.10.0030.02311.28
5.4.00.0040.02411.13
5.3.290.0060.02511.51
5.3.280.0070.02211.42
5.3.270.0050.02311.44
5.3.260.0010.02411.43
5.3.250.0070.01811.51
5.3.240.0140.01811.35
5.3.230.0040.02611.42
5.3.220.0020.02511.44
5.3.210.0040.02911.44
5.3.200.0060.02011.31
5.3.190.0100.02011.43
5.3.180.0050.02311.41
5.3.170.0050.02511.49
5.3.160.0070.02811.47
5.3.150.0070.02211.37
5.3.140.0050.01911.38
5.3.130.0070.02011.47
5.3.120.0070.02011.50
5.3.110.0040.02311.33
5.3.100.0040.02211.18
5.3.90.0050.02011.11
5.3.80.0080.02011.12
5.3.70.0050.02211.13
5.3.60.0050.01911.12
5.3.50.0060.02010.96
5.3.40.0070.02011.04
5.3.30.0090.01810.99
5.3.20.0050.02110.93
5.3.10.0060.02010.80
5.3.00.0040.02310.70
5.2.170.0080.0199.22
5.2.160.0040.0189.10
5.2.150.0070.0159.30
5.2.140.0050.0189.06
5.2.130.0050.0159.25
5.2.120.0040.0199.20
5.2.110.0030.0189.19
5.2.100.0060.0169.10
5.2.90.0040.0159.18
5.2.80.0080.0239.01
5.2.70.0040.0199.04
5.2.60.0070.0178.95
5.2.50.0070.0199.17
5.2.40.0060.0159.11
5.2.30.0070.0159.00
5.2.20.0060.0189.08
5.2.10.0060.0168.96
5.2.00.0070.0148.73
5.1.60.0040.0168.20
5.1.50.0040.0158.21
5.1.40.0050.0148.25
5.1.30.0040.0158.33
5.1.20.0020.0168.39
5.1.10.0020.0208.29
5.1.00.0050.0158.19
5.0.50.0060.0137.16
5.0.40.0060.0117.09
5.0.30.0040.0176.99
5.0.20.0020.0146.98
5.0.10.0030.0146.97
5.0.00.0070.0146.96
4.4.90.0040.0086.24
4.4.80.0040.0096.22
4.4.70.0050.0076.22
4.4.60.0040.0096.22
4.4.50.0040.0106.23
4.4.40.0030.0136.20
4.4.30.0040.0116.23
4.4.20.0020.0126.27
4.4.10.0040.0106.27
4.4.00.0040.0136.22
4.3.110.0040.0096.18
4.3.100.0010.0116.18
4.3.90.0030.0096.16
4.3.80.0030.0136.14
4.3.70.0030.0106.16
4.3.60.0040.0096.16
4.3.50.0020.0096.16
4.3.40.0040.0146.12
4.3.30.0020.0135.49
4.3.20.0050.0095.48
4.3.10.0050.0085.46
4.3.00.0130.0107.49

preferences:
42.6 ms | 400 KiB | 5 Q