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, 0); $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.60.0150.00018.31
8.3.50.0120.01021.06
8.3.40.0160.00318.66
8.3.30.0140.00319.09
8.3.20.0000.00820.21
8.3.10.0080.00023.70
8.3.00.0060.00319.38
8.2.180.0000.01516.38
8.2.170.0120.00322.96
8.2.160.0100.01020.35
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00322.31
8.2.110.0040.00420.82
8.2.100.0040.00817.97
8.2.90.0000.00819.30
8.2.80.0000.00817.97
8.2.70.0050.00517.50
8.2.60.0040.00417.93
8.2.50.0000.00818.10
8.2.40.0050.00319.77
8.2.30.0040.00418.04
8.2.20.0040.00417.81
8.2.10.0040.00418.18
8.2.00.0000.00817.74
8.1.280.0040.01125.92
8.1.270.0090.00022.04
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.00322.31
8.1.230.0070.00417.60
8.1.220.0030.00517.91
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0050.00317.22
8.1.180.0040.00418.10
8.1.170.0000.00918.59
8.1.160.0040.00421.98
8.1.150.0040.00418.87
8.1.140.0000.00717.39
8.1.130.0030.00317.80
8.1.120.0000.00717.54
8.1.110.0050.00317.39
8.1.100.0030.00517.54
8.1.90.0050.00317.55
8.1.80.0080.00017.41
8.1.70.0070.00017.38
8.1.60.0090.00017.55
8.1.50.0050.00317.66
8.1.40.0040.00417.58
8.1.30.0080.00017.73
8.1.20.0070.00017.68
8.1.10.0080.00317.56
8.1.00.0080.00017.39
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0070.00018.41
8.0.270.0030.00317.30
8.0.260.0000.00617.37
8.0.250.0000.00717.05
8.0.240.0050.00317.04
8.0.230.0020.00516.99
8.0.220.0030.00316.86
8.0.210.0060.00016.97
8.0.200.0030.00317.04
8.0.190.0060.00317.00
8.0.180.0040.00416.98
8.0.170.0050.00317.02
8.0.160.0000.00816.88
8.0.150.0000.00816.89
8.0.140.0040.00416.82
8.0.130.0000.00613.30
8.0.120.0040.00416.95
8.0.110.0050.00316.93
8.0.100.0070.00016.87
8.0.90.0000.00716.84
8.0.80.0080.00916.84
8.0.70.0040.00416.98
8.0.60.0040.00416.99
8.0.50.0000.00817.00
8.0.30.0060.01417.27
8.0.20.0130.00617.42
8.0.10.0000.00816.96
8.0.00.0050.01416.95
7.4.330.0060.00015.02
7.4.320.0000.00616.46
7.4.300.0000.00616.65
7.4.290.0000.00616.57
7.4.280.0070.00316.55
7.4.270.0040.00416.58
7.4.260.0090.00016.55
7.4.250.0000.00816.51
7.4.240.0060.00216.66
7.4.230.0070.00016.50
7.4.220.0130.00616.65
7.4.210.0060.01216.62
7.4.200.0040.00416.45
7.4.160.0100.00816.43
7.4.150.0040.01817.40
7.4.140.0160.00617.86
7.4.130.0080.00916.63
7.4.120.0120.00516.65
7.4.110.0200.00316.50
7.4.100.0100.01016.51
7.4.90.0070.01116.49
7.4.80.0090.00919.39
7.4.70.0030.01316.52
7.4.60.0030.01416.66
7.4.50.0040.00416.19
7.4.40.0060.01116.38
7.4.30.0110.01116.58
7.4.00.0050.00814.96
7.3.330.0030.00313.38
7.3.320.0000.00513.22
7.3.310.0040.00416.47
7.3.300.0000.00616.45
7.3.290.0110.01216.46
7.3.280.0080.01116.49
7.3.270.0060.01217.40
7.3.260.0160.00416.60
7.3.250.0040.01416.63
7.3.240.0090.00916.71
7.3.230.0120.00416.64
7.3.210.0080.00816.47
7.3.200.0110.01119.39
7.3.190.0130.01016.77
7.3.180.0120.00916.42
7.3.170.0040.01216.74
7.3.160.0030.01616.62
7.3.120.0070.01014.57
7.3.110.0100.00614.85
7.3.100.0070.00314.59
7.3.90.0090.00914.92
7.3.80.0060.00614.88
7.3.70.0030.00814.86
7.3.60.0060.00615.13
7.3.50.0070.01015.03
7.3.40.0000.01114.72
7.3.30.0060.00614.91
7.3.20.0070.00716.90
7.3.10.0040.00816.34
7.3.00.0030.00616.69
7.2.330.0160.00616.87
7.2.320.0030.01516.69
7.2.310.0030.01316.89
7.2.300.0090.00916.80
7.2.290.0150.00716.83
7.2.250.0130.00615.02
7.2.240.0060.01315.35
7.2.230.0030.01315.36
7.2.220.0060.00915.04
7.2.210.0100.00615.13
7.2.200.0030.00814.87
7.2.190.0060.00615.30
7.2.180.0040.00715.13
7.2.170.0070.00715.00
7.2.110.0140.01116.35
7.2.00.0030.01019.48
7.1.330.0070.00715.83
7.1.320.0030.00515.73
7.1.310.0100.00015.83
7.1.300.0080.00415.65
7.1.290.0030.01215.66
7.1.280.0030.01515.85
7.1.270.0070.00715.64
7.1.260.0030.01015.67
7.1.100.0040.01417.95
7.1.70.0000.00717.41
7.1.60.0070.00316.94
7.1.50.0090.00917.09
7.1.00.0070.07322.63
7.0.200.0060.01016.77
7.0.140.0070.07022.22
7.0.60.0100.05720.21
7.0.50.0130.07318.17
7.0.40.0100.04720.17
7.0.30.0230.07020.22
7.0.20.0230.08020.32
7.0.10.0000.07020.16
7.0.00.0070.08720.30
5.6.280.0070.07021.12
5.6.210.0070.06320.82
5.6.200.0070.08018.34
5.6.190.0070.06320.40
5.6.180.0230.04720.53
5.6.170.0330.04720.70
5.6.160.0030.04320.68
5.6.150.0070.08018.25
5.6.140.0070.08018.41
5.6.130.0070.08018.24
5.6.120.0170.06321.27
5.6.110.0200.05721.20
5.6.100.0030.05321.14
5.6.90.0100.04721.17
5.6.80.0070.08320.51
5.5.350.4200.03720.58
5.5.340.0000.04318.21
5.5.330.0100.03320.25
5.5.320.0230.07720.30
5.5.310.0570.05720.49
5.5.300.0070.06018.05
5.5.290.0030.08718.17
5.5.280.0170.08320.93
5.5.270.0070.06721.00
5.5.260.0030.08321.09
5.5.250.0070.05320.85
5.5.240.0170.06320.29
5.4.450.0030.06719.73
5.4.440.0730.05719.25
5.4.430.0730.07319.54
5.4.420.0670.00019.57
5.4.410.0670.00019.70
5.4.400.0670.00019.13
5.4.390.0630.00019.28
5.4.380.0770.00019.34
5.4.370.0630.00019.18
5.4.360.0600.00019.34
5.4.350.0730.00019.38
5.4.340.0070.03511.99
5.4.320.0070.03612.47
5.4.310.0080.03612.47
5.4.300.0070.03612.47
5.4.290.0020.04212.47
5.4.280.0030.04012.37
5.4.270.0090.03412.37
5.4.260.0070.03612.37
5.4.250.0070.03912.37
5.4.240.0070.04512.37
5.4.230.0050.03912.36
5.4.220.0080.03412.36
5.4.210.0070.03712.36
5.4.200.0060.03812.36
5.4.190.0080.04912.36
5.4.180.0070.05012.36
5.4.170.0060.03612.37
5.4.160.0040.03912.37
5.4.150.0080.04112.36
5.4.140.0060.03712.04
5.4.130.0040.03912.04
5.4.120.0080.05011.99
5.4.110.0090.03311.99
5.4.100.0090.04711.98
5.4.90.0100.03511.99
5.4.80.0070.03711.99
5.4.70.0090.03311.98
5.4.60.0070.03311.98
5.4.50.0090.03711.98
5.4.40.0060.03411.97
5.4.30.0040.03911.97
5.4.20.0050.04011.96
5.4.10.0070.04511.97
5.4.00.0100.03811.46
5.3.290.0060.03912.80
5.3.280.0040.04012.71
5.3.270.0040.04112.72
5.3.260.0070.04112.72
5.3.250.0120.03312.72
5.3.240.0050.03812.71
5.3.230.0090.03612.70
5.3.220.0060.03712.68
5.3.210.0080.04112.68
5.3.200.0090.03312.68
5.3.190.0070.04012.68
5.3.180.0090.03412.67
5.3.170.0060.03712.67
5.3.160.0050.03712.67
5.3.150.0070.03612.67
5.3.140.0110.03612.66
5.3.130.0060.04012.65
5.3.120.0080.03712.66
5.3.110.0070.03912.66
5.3.100.0070.03912.12
5.3.90.0080.03612.08
5.3.80.0040.03812.07
5.3.70.0080.03412.08
5.3.60.0060.03612.06
5.3.50.0050.03712.00
5.3.40.0080.03412.00
5.3.30.0040.03711.95
5.3.20.0060.03411.72
5.3.10.0090.03711.70
5.3.00.0080.03411.68
5.2.170.0050.0309.18
5.2.160.0080.0309.18
5.2.150.0030.0329.18
5.2.140.0040.0359.18
5.2.130.0060.0339.13
5.2.120.0050.0319.14
5.2.110.0060.0279.14
5.2.100.0040.0299.14
5.2.90.0100.0239.14
5.2.80.0050.0299.14
5.2.70.0070.0309.14
5.2.60.0050.0309.10
5.2.50.0030.0419.06
5.2.40.0040.0339.04
5.2.30.0070.0289.02
5.2.20.0050.0289.00
5.2.10.0050.0288.92
5.2.00.0060.0288.79
5.1.60.0060.0248.07
5.1.50.0040.0348.06
5.1.40.0030.0288.05
5.1.30.0040.0268.39
5.1.20.0070.0288.42
5.1.10.0030.0268.14
5.1.00.0020.0278.14
5.0.50.0040.0246.62
5.0.40.0040.0196.48
5.0.30.0050.0296.29
5.0.20.0020.0216.26
5.0.10.0060.0176.24
5.0.00.0030.0306.23
4.4.90.0050.0134.78
4.4.80.0040.0144.76
4.4.70.0040.0144.75
4.4.60.0040.0144.75
4.4.50.0030.0154.77
4.4.40.0020.0264.71
4.4.30.0020.0164.76
4.4.20.0030.0154.85
4.4.10.0020.0184.85
4.4.00.0030.0244.76
4.3.110.0020.0164.67
4.3.100.0040.0144.67
4.3.90.0030.0144.63
4.3.80.0020.0254.58
4.3.70.0040.0134.63
4.3.60.0020.0184.62
4.3.50.0020.0164.63
4.3.40.0010.0254.53
4.3.30.0010.0163.28
4.3.20.0020.0163.26
4.3.10.0040.0153.22
4.3.00.0130.0237.29

preferences:
50.63 ms | 401 KiB | 5 Q