3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convert($i){ $rules = array("KB"=>1000, "MB"=>1000000, "GB"=>1000000000,"TB"=>1000000000000); $reversedRules= array_reverse($rules); foreach($reversedRules as $k=>$r){ if(($output = $i/$r) >= 1){ return round($output).$k; } } return $i."B"; } echo convert(21312312312312321); echo convert(1000); echo convert(1232); echo convert(9999999); echo convert(12); echo convert(231671851); echo convert(321784535432);

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.140.0130.00817.70
8.4.130.0110.01022.02
8.4.120.0110.00822.57
8.4.110.0050.00422.52
8.4.100.0130.00818.68
8.4.90.0120.00918.88
8.4.80.0110.00618.79
8.4.70.0080.00917.68
8.4.60.0150.00818.62
8.4.50.0140.00618.72
8.4.40.0080.00317.62
8.4.30.0160.00317.50
8.4.20.0100.01017.61
8.4.10.0100.01017.86
8.3.270.0120.00816.61
8.3.260.0100.00916.66
8.3.250.0120.00618.76
8.3.240.0110.00817.01
8.3.230.0120.00716.59
8.3.220.0090.00919.01
8.3.210.0110.00816.54
8.3.200.0060.00216.61
8.3.190.0140.00417.29
8.3.180.0100.00917.26
8.3.170.0070.01120.44
8.3.160.0060.01217.24
8.3.150.0160.00316.82
8.3.140.0040.00416.57
8.3.130.0060.00316.53
8.3.120.0090.00020.60
8.3.110.0000.00916.61
8.3.100.0000.01516.72
8.3.90.0000.00726.77
8.3.80.0060.00316.50
8.3.70.0110.01116.63
8.3.60.0000.01516.50
8.3.50.0030.01617.44
8.3.40.0090.01218.96
8.3.30.0040.01118.84
8.3.20.0070.00721.87
8.3.10.0090.00921.85
8.3.00.0060.00319.69
8.2.290.0080.01120.39
8.2.280.0090.01018.61
8.2.270.0110.00717.03
8.2.260.0110.00716.65
8.2.250.0070.01318.22
8.2.240.0060.00318.78
8.2.230.0040.00420.94
8.2.220.0100.00724.06
8.2.210.0050.00326.77
8.2.200.0070.00716.61
8.2.190.0090.00616.58
8.2.180.0090.00925.92
8.2.170.0120.00618.91
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0110.00724.66
8.2.130.0040.01119.21
8.2.120.0040.00426.35
8.2.110.0090.00021.00
8.2.100.0060.00617.89
8.2.90.0040.00417.91
8.2.80.0000.00919.76
8.2.70.0080.00017.93
8.2.60.0080.00017.93
8.2.50.0040.00418.34
8.2.40.0040.00420.64
8.2.30.0000.00719.53
8.2.20.0050.00218.13
8.2.10.0040.00418.10
8.2.00.0040.00418.18
8.1.330.0120.00621.78
8.1.320.0070.00316.27
8.1.310.0100.00716.84
8.1.300.0000.00818.47
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0080.00022.31
8.1.260.0110.00426.35
8.1.250.0000.00728.09
8.1.240.0090.00022.19
8.1.230.0100.00021.04
8.1.220.0030.00517.91
8.1.210.0000.00819.09
8.1.200.0030.00617.35
8.1.190.0040.00417.23
8.1.180.0080.00018.10
8.1.170.0040.00418.88
8.1.160.0050.00218.88
8.1.150.0040.00419.07
8.1.140.0000.00717.68
8.1.130.0040.00419.07
8.1.120.0000.00717.53
8.1.110.0070.00017.52
8.1.100.0080.00017.53
8.1.90.0050.00317.54
8.1.80.0060.00317.51
8.1.70.0000.00817.52
8.1.60.0030.00517.63
8.1.50.0000.00717.55
8.1.40.0070.00317.53
8.1.30.0080.00017.64
8.1.20.0000.01117.59
8.1.10.0060.00317.55
8.1.00.0000.01017.53
8.0.300.0000.00719.77
8.0.290.0090.00016.88
8.0.280.0030.00318.41
8.0.270.0030.00317.24
8.0.260.0030.00317.20
8.0.250.0000.00717.02
8.0.240.0040.00417.06
8.0.230.0030.00317.05
8.0.220.0000.00716.87
8.0.210.0070.00016.95
8.0.200.0030.00316.89
8.0.190.0030.00517.02
8.0.180.0000.00716.94
8.0.170.0040.00716.85
8.0.160.0000.00816.95
8.0.150.0070.00016.88
8.0.140.0000.00716.89
8.0.130.0030.00313.43
8.0.120.0060.00316.96
8.0.110.0000.00716.89
8.0.100.0000.00716.99
8.0.90.0040.00416.82
8.0.80.0130.00316.86
8.0.70.0050.00216.80
8.0.60.0070.00016.86
8.0.50.0000.00716.81
8.0.30.0070.01116.99
8.0.20.0100.00917.40
8.0.10.0000.00716.86
8.0.00.0110.00716.88
7.4.330.0030.00315.55
7.4.320.0060.00316.55
7.4.300.0060.00016.64
7.4.290.0000.00916.61
7.4.280.0000.00716.64
7.4.270.0030.00316.69
7.4.260.0000.00816.65
7.4.250.0070.00016.54
7.4.240.0000.00716.49
7.4.230.0000.00716.45
7.4.220.0050.00216.59
7.4.210.0080.00816.49
7.4.200.0030.00316.64
7.4.160.0100.00816.49
7.4.140.0120.00617.86
7.4.130.0030.01516.58
7.4.120.0050.01316.59
7.4.110.0090.01316.53
7.4.100.0140.00316.52
7.4.90.0090.00916.30
7.4.80.0130.01019.39
7.4.70.0080.01516.55
7.4.60.0100.00716.53
7.4.50.0080.00816.51
7.4.40.0040.01816.27
7.4.00.0040.01014.81
7.3.330.0020.00213.37
7.3.320.0000.00813.27
7.3.310.0000.00716.39
7.3.300.0000.00716.29
7.3.290.0040.00416.29
7.3.280.0060.01016.43
7.3.260.0120.00716.49
7.3.240.0100.00916.64
7.3.230.0060.01016.66
7.3.210.0130.00716.34
7.3.200.0090.00616.48
7.3.190.0070.01416.71
7.3.180.0140.01016.68
7.3.170.0080.00916.34
7.3.160.0070.01016.56
7.2.330.0090.01216.73
7.2.320.0060.01516.92
7.2.310.0100.00716.57
7.2.300.0130.01016.49
7.2.290.0130.01216.80
7.2.60.0040.00817.04
7.2.40.0800.01418.07
7.2.30.0410.01218.21
7.2.20.0390.01117.82
7.2.10.0540.01317.83
7.2.00.0420.01618.21
7.1.200.0030.00615.89
7.1.160.0480.01116.77
7.1.150.0390.01116.63
7.1.140.0470.00916.89
7.1.130.0590.01116.88
7.1.120.0580.01016.75
7.1.110.0540.00816.19
7.1.100.0800.01416.23
7.1.90.0470.01316.08
7.1.80.0530.01216.24
7.1.70.0630.00714.99
7.1.60.0890.01433.14
7.1.50.0650.01932.63
7.1.40.0980.01832.46
7.1.30.1060.01832.42
7.1.20.0760.01632.67
7.1.10.0610.00914.51
7.1.00.1520.01215.02

preferences:
29.6 ms | 403 KiB | 5 Q