3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fb1($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives // $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } function fb2($size, $precision = 2) { $base = log($size) / log(1024); $suffixes = array('', 'k', 'M', 'G', 'T'); return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)]; } function fb3($size) { $base = log($size) / log(1024); $suffix = array("", "k", "M", "G", "T")[floor($base)]; return pow(1024, $base - floor($base)) . $suffix; } echo fb1(24962496) . "\n\n"; echo fb2(24962496) . "\n\n"; echo fb3(24962496) . "\n\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.0100.00716.75
8.3.50.0100.00921.34
8.3.40.0070.00718.84
8.3.30.0140.00019.55
8.3.20.0040.00420.36
8.3.10.0040.00423.83
8.3.00.0090.00019.38
8.2.180.0070.00716.75
8.2.170.0150.00322.96
8.2.160.0150.00020.64
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.43
8.2.110.0040.00422.54
8.2.100.0110.00418.00
8.2.90.0040.00419.61
8.2.80.0000.00918.00
8.2.70.0060.00717.86
8.2.60.0080.00018.29
8.2.50.0000.00818.07
8.2.40.0060.00320.19
8.2.30.0000.00718.42
8.2.20.0040.00418.01
8.2.10.0080.00018.44
8.2.00.0000.00718.02
8.1.280.0040.01525.92
8.1.270.0040.00423.98
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00324.27
8.1.230.0070.00419.48
8.1.220.0040.00418.04
8.1.210.0040.00418.77
8.1.200.0070.00317.60
8.1.190.0060.00317.48
8.1.180.0050.00318.10
8.1.170.0030.00518.96
8.1.160.0000.00722.28
8.1.150.0020.00519.16
8.1.140.0040.00417.75
8.1.130.0030.00318.02
8.1.120.0000.00717.68
8.1.110.0080.00017.77
8.1.100.0040.00417.68
8.1.90.0040.00417.59
8.1.80.0030.00517.73
8.1.70.0000.00717.60
8.1.60.0040.00417.71
8.1.50.0080.00017.84
8.1.40.0040.00417.66
8.1.30.0050.00317.79
8.1.20.0040.00417.86
8.1.10.0080.00017.91
8.1.00.0040.00417.74
8.0.300.0000.00918.77
8.0.290.0040.00417.13
8.0.280.0040.00418.71
8.0.270.0000.00717.53
8.0.260.0000.00817.56
8.0.250.0050.00217.09
8.0.240.0040.00417.23
8.0.230.0050.00217.22
8.0.220.0070.00017.20
8.0.210.0030.00317.07
8.0.200.0030.00717.11
8.0.190.0040.00417.06
8.0.180.0040.00417.20
8.0.170.0040.00417.14
8.0.160.0070.00317.25
8.0.150.0000.00816.95
8.0.140.0040.00417.18
8.0.130.0060.00013.67
8.0.120.0060.00317.09
8.0.110.0000.00817.15
8.0.100.0000.00817.21
8.0.90.0000.00817.26
8.0.80.0100.00716.98
8.0.70.0030.00616.99
8.0.60.0040.00417.07
8.0.50.0040.00417.14
8.0.30.0080.01117.29
8.0.20.0070.01217.40
8.0.10.0000.00817.33
8.0.00.0060.01116.88
7.4.330.0020.00215.20
7.4.320.0030.00316.87
7.4.300.0000.00616.80
7.4.290.0030.00616.90
7.4.280.0030.00516.71
7.4.270.0000.00716.79
7.4.260.0000.00816.71
7.4.250.0000.00816.71
7.4.240.0030.00316.84
7.4.230.0030.00316.75
7.4.220.0160.00616.64
7.4.210.0080.00816.91
7.4.200.0060.00316.77
7.4.160.0100.01016.79
7.4.150.0070.01117.40
7.4.140.0140.00517.86
7.4.130.0080.00816.84
7.4.120.0060.01216.88
7.4.110.0100.01016.84
7.4.100.0040.01416.69
7.4.90.0130.00316.78
7.4.80.0070.01419.39
7.4.70.0140.00616.79
7.4.60.0130.01016.66
7.4.50.0000.00816.74
7.4.40.0090.01216.48
7.4.30.0110.00816.68
7.4.00.0120.00315.36
7.3.330.0000.00513.62
7.3.320.0000.00513.49
7.3.310.0070.00016.72
7.3.300.0000.00716.51
7.3.290.0120.00316.57
7.3.280.0080.00916.58
7.3.270.0090.00917.40
7.3.260.0070.01016.71
7.3.250.0050.01516.79
7.3.240.0160.00816.55
7.3.230.0180.00416.52
7.3.210.0090.00916.76
7.3.200.0090.01219.39
7.3.190.0160.00316.78
7.3.180.0030.01316.65
7.3.170.0060.00916.62
7.3.160.0040.01216.55
7.2.330.0000.01716.65
7.2.320.0170.00416.86
7.2.310.0090.00916.80
7.2.300.0070.01016.71
7.2.290.0090.00916.83
7.2.60.0070.00717.41
7.2.00.0060.00619.93
7.1.200.0090.00016.25
7.1.100.0040.00718.47
7.1.70.0000.01017.32
7.1.60.0070.01719.32
7.1.50.0080.01517.33
7.1.00.0000.08022.89
7.0.200.0040.00417.10
7.0.140.0030.07722.34
7.0.60.0130.03320.24
7.0.50.0030.04718.38
7.0.40.0030.06720.50
7.0.30.0200.04020.32
7.0.20.0230.07720.49
7.0.10.0170.04320.33
7.0.00.0100.03320.39
5.6.280.0070.07021.45
5.6.210.0130.07020.87
5.6.200.0200.07318.54
5.6.190.0070.06720.77
5.6.180.0200.04020.86
5.6.170.0300.08020.95
5.6.160.0030.08720.71
5.6.150.0070.06318.43
5.6.140.0030.09718.42
5.6.130.0130.07718.42
5.6.120.0100.05321.12
5.6.110.0170.06721.37
5.6.100.0070.08021.40
5.6.90.0070.06321.32
5.6.80.0030.03720.74
5.5.350.0270.06720.76
5.5.340.0130.04318.35
5.5.330.0070.05720.60
5.5.320.0370.06020.55
5.5.310.0230.04320.54
5.5.300.0030.08318.23
5.5.290.0030.07018.32
5.5.280.0100.07321.01
5.5.270.0070.08321.24
5.5.260.0030.04021.14
5.5.250.0130.08020.82
5.5.240.0230.07020.48
5.4.450.0930.06019.44
5.4.440.0870.06319.33
5.4.430.1170.08319.60
5.4.420.0670.00019.51
5.4.410.0630.00019.27
5.4.400.0630.00019.08
5.4.390.0770.00019.12
5.4.380.0830.00019.16
5.4.370.0670.00019.26
5.4.360.0870.00019.16
5.4.350.0630.00019.21
5.4.340.0060.03512.03
5.4.320.0090.03312.52
5.4.310.0050.04112.53
5.4.300.0140.03912.53
5.4.290.0050.04212.52
5.4.280.0110.03512.42
5.4.270.0080.03512.41
5.4.260.0060.03912.41
5.4.250.0080.04212.41
5.4.240.0050.03812.41
5.4.230.0060.04012.41
5.4.220.0080.04012.41
5.4.210.0080.03812.41
5.4.200.0080.03612.41
5.4.190.0080.04012.41
5.4.180.0070.03712.40
5.4.170.0070.03512.41
5.4.160.0060.03612.41
5.4.150.0080.03812.40
5.4.140.0060.03712.09
5.4.130.0100.03612.07
5.4.120.0060.04112.04
5.4.110.0070.03812.04
5.4.100.0040.03912.04
5.4.90.0080.03712.04
5.4.80.0060.04012.04
5.4.70.0060.03712.03
5.4.60.0060.03512.03
5.4.50.0060.03612.03
5.4.40.0070.04112.02
5.4.30.0070.03912.01
5.4.20.0070.03712.01
5.4.10.0070.03312.02
5.4.00.0050.03611.51
5.3.290.0080.04312.80
5.3.280.0050.03912.71
5.3.270.0050.04212.72
5.3.260.0120.03512.72
5.3.250.0050.03812.72
5.3.240.0100.03212.72
5.3.230.0080.03812.71
5.3.220.0050.04012.68
5.3.210.0070.03912.68
5.3.200.0060.03912.68
5.3.190.0060.03712.68
5.3.180.0080.03712.67
5.3.170.0040.03812.67
5.3.160.0090.04212.67
5.3.150.0090.03612.67
5.3.140.0060.03912.66
5.3.130.0070.04812.66
5.3.120.0040.05712.65
5.3.110.0100.04212.66
5.3.100.0100.03712.14
5.3.90.0050.03812.12
5.3.80.0080.03512.10
5.3.70.0080.04012.10
5.3.60.0080.03812.09
5.3.50.0060.03912.04
5.3.40.0080.03712.04
5.3.30.0070.03712.00
5.3.20.0090.03311.78
5.3.10.0110.04111.74
5.3.00.0060.04411.73
5.2.170.0080.0329.23
5.2.160.0060.0289.23
5.2.150.0050.0309.23
5.2.140.0080.0289.23
5.2.130.0070.0299.19
5.2.120.0070.0359.19
5.2.110.0060.0309.20
5.2.100.0050.0309.19
5.2.90.0080.0349.19
5.2.80.0060.0339.19
5.2.70.0050.0359.19
5.2.60.0080.0349.15
5.2.50.0040.0389.11
5.2.40.0060.0289.09
5.2.30.0050.0339.06
5.2.20.0050.0309.05
5.2.10.0030.0338.96
5.2.00.0070.0388.82
5.1.60.0040.0268.10
5.1.50.0070.0318.10
5.1.40.0070.0248.09
5.1.30.0060.0268.43
5.1.20.0030.0318.45
5.1.10.0100.0288.18
5.1.00.0060.0278.18
5.0.50.0050.0216.66
5.0.40.0040.0216.52
5.0.30.0040.0316.33
5.0.20.0040.0196.30
5.0.10.0070.0226.27
5.0.00.0050.0356.27
4.4.90.0020.0184.78
4.4.80.0050.0174.75
4.4.70.0040.0184.75
4.4.60.0040.0184.76
4.4.50.0030.0204.77
4.4.40.0030.0274.71
4.4.30.0060.0144.75
4.4.20.0040.0154.85
4.4.10.0010.0184.85
4.4.00.0030.0284.75
4.3.110.0050.0194.67
4.3.100.0010.0234.67
4.3.90.0050.0194.64
4.3.80.0030.0694.58
4.3.70.0020.0154.63
4.3.60.0050.0144.63
4.3.50.0010.0184.63
4.3.40.0030.0244.54
4.3.30.0040.0173.32
4.3.20.0030.0203.30
4.3.10.0030.0153.25
4.3.00.0100.0377.20

preferences:
51.16 ms | 401 KiB | 5 Q