3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertToBytes(string $from): ?int { $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; $number = substr($from, 0, -2); $suffix = strtoupper(substr($from,-2)); //B or no suffix if(is_numeric(substr($suffix, 0, 1))) { return preg_replace('/[^\d]/', '', $from); } $exponent = array_flip($units)[$suffix] ?? null; if($exponent === null) { return null; } return $number * (1024 ** $exponent); } var_dump(convertToBytes("110GB"));

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.5.10.0070.01216.70
8.5.00.0110.01119.82
8.4.150.0020.00114.05
8.4.140.0150.00717.72
8.4.130.0110.00818.83
8.4.120.0110.00823.83
8.4.110.0110.00720.70
8.4.100.0120.00518.86
8.4.90.0050.00322.43
8.4.80.0120.00918.63
8.4.70.0120.01217.87
8.4.60.0120.00418.61
8.4.50.0090.01118.78
8.4.40.0060.00819.46
8.4.30.0090.00617.89
8.4.20.0030.00720.89
8.4.10.0030.00617.96
8.3.280.0130.00818.38
8.3.270.0110.00816.78
8.3.260.0050.00516.70
8.3.250.0100.00819.05
8.3.240.0040.00517.21
8.3.230.0050.00416.81
8.3.220.0130.00519.05
8.3.210.0080.00916.62
8.3.200.0030.00516.59
8.3.190.0050.00317.20
8.3.180.0130.00716.48
8.3.170.0170.00018.97
8.3.160.0030.00520.02
8.3.150.0060.00916.56
8.3.140.0050.00316.47
8.3.130.0080.00018.24
8.3.120.0040.00420.55
8.3.110.0090.00020.94
8.3.100.0030.00616.53
8.3.90.0040.00426.77
8.3.80.0080.00316.63
8.3.70.0000.01516.58
8.3.60.0090.00618.18
8.3.50.0170.00118.48
8.3.40.0140.00718.70
8.3.30.0180.00018.60
8.3.20.0040.00420.77
8.3.10.0000.00821.77
8.3.00.0050.00221.83
8.2.290.0100.00820.23
8.2.280.0060.00420.13
8.2.270.0060.01219.14
8.2.260.0030.01418.31
8.2.250.0080.00016.52
8.2.240.0070.01117.04
8.2.230.0040.00422.58
8.2.220.0090.00924.06
8.2.210.0050.00326.77
8.2.200.0060.00616.63
8.2.190.0100.01016.58
8.2.180.0070.00725.92
8.2.170.0060.00918.86
8.2.160.0070.00719.33
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00820.78
8.2.110.0090.00021.18
8.2.100.0040.00717.97
8.2.90.0040.00417.50
8.2.80.0040.00417.97
8.2.70.0080.00018.00
8.2.60.0030.00618.16
8.2.50.0000.00818.10
8.2.40.0020.00519.52
8.2.30.0000.00820.68
8.2.20.0070.00018.04
8.2.10.0000.00719.52
8.2.00.0000.00718.02
8.1.330.0130.00522.04
8.1.320.0090.00615.96
8.1.310.0130.00618.27
8.1.300.0040.00417.86
8.1.290.0060.00330.84
8.1.280.0040.01525.92
8.1.270.0070.00022.08
8.1.260.0000.00826.35
8.1.250.0030.00528.09
8.1.240.0040.00422.17
8.1.230.0090.00622.61
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0040.00417.13
8.1.190.0080.00017.23
8.1.180.0080.00018.10
8.1.170.0050.00518.42
8.1.160.0070.00018.93
8.1.150.0070.00018.87
8.1.140.0070.00018.93
8.1.130.0030.00320.19
8.1.120.0000.00717.28
8.1.110.0040.00417.38
8.1.100.0080.00017.39
8.1.90.0050.00317.27
8.1.80.0040.00417.41
8.1.70.0030.00317.29
8.1.60.0030.00517.58
8.1.50.0000.00817.51
8.1.40.0050.00317.41
8.1.30.0040.00417.64
8.1.20.0040.00417.59
8.1.10.0000.00717.63
8.1.00.0060.00317.47
8.0.300.0000.00719.64
8.0.290.0060.00316.63
8.0.280.0000.00718.43
8.0.270.0030.00616.82
8.0.260.0060.00318.45
8.0.250.0070.00316.92
8.0.240.0030.00316.93
8.0.230.0050.00216.99
8.0.220.0060.00316.90
8.0.210.0000.00716.90
8.0.200.0000.00616.83
8.0.190.0070.00316.91
8.0.180.0050.00216.87
8.0.170.0030.00516.91
8.0.160.0080.00016.93
8.0.150.0000.00716.81
8.0.140.0040.00416.80
8.0.130.0030.00313.20
8.0.120.0000.00716.68
8.0.110.0000.00716.69
8.0.100.0040.00416.68
8.0.90.0000.00716.89
8.0.80.0040.01416.79
8.0.70.0030.00316.69
8.0.60.0000.00716.71
8.0.50.0000.00716.69
8.0.30.0100.00717.02
8.0.20.0110.01116.94
8.0.10.0040.00416.91
8.0.00.0100.00816.78
7.4.330.0060.00015.55
7.4.320.0040.00416.59
7.4.300.0030.00316.39
7.4.290.0030.00316.56
7.4.280.0080.00016.58
7.4.270.0070.00016.58
7.4.260.0050.00316.59
7.4.250.0050.00216.52
7.4.240.0000.00716.60
7.4.230.0040.00416.62
7.4.220.0000.00816.69
7.4.210.0080.00816.51
7.4.200.0030.00316.66
7.4.160.0120.00516.39
7.4.140.0160.00017.86
7.4.130.0120.00816.45
7.4.120.0100.00816.42
7.4.110.0130.00316.41
7.4.100.0030.01316.38
7.4.90.0100.00616.50
7.4.80.0070.01019.39
7.4.70.0080.00816.49
7.4.60.0140.00716.44
7.4.50.0030.00716.35
7.4.40.0060.01216.43
7.4.00.0030.00914.71
7.3.330.0050.00013.35
7.3.320.0050.00013.33
7.3.310.0050.00216.39
7.3.300.0030.00316.34
7.3.290.0100.00316.35
7.3.280.0090.00616.35
7.3.260.0090.00916.54
7.3.240.0090.01116.46
7.3.230.0100.00716.57
7.3.210.0070.01016.59
7.3.200.0100.00616.61
7.3.190.0100.00616.56
7.3.180.0110.00616.67
7.3.170.0060.00916.19
7.3.160.0060.00916.36
7.3.120.0040.01514.69
7.3.110.0100.00314.75
7.3.100.0030.00614.91
7.3.90.0080.00814.68
7.3.80.0030.01215.08
7.3.70.0070.01014.84
7.3.60.0040.01114.71
7.3.50.0030.00914.81
7.3.40.0130.00314.65
7.3.30.0120.00914.66
7.3.20.0150.00515.79
7.3.10.0100.00415.69
7.3.00.0310.00615.80
7.2.330.0110.00616.61
7.2.320.0070.01016.58
7.2.310.0070.01016.74
7.2.300.0060.01316.36
7.2.290.0080.00816.43
7.2.240.0070.00314.90
7.2.230.0100.00315.18
7.2.220.0040.00815.10
7.2.210.0090.00915.07
7.2.200.0060.01014.93
7.2.190.0090.00915.04
7.2.180.0080.00614.75
7.2.170.0040.00914.98
7.2.160.0040.01015.01
7.2.150.0050.00915.84
7.2.140.0090.00415.77
7.2.130.0130.01315.77
7.2.120.0040.01115.81
7.2.110.0150.00715.94
7.2.100.0130.01216.06
7.2.90.0100.01015.88
7.2.80.0090.01216.07
7.2.70.0100.01016.03
7.2.60.0120.01115.79
7.2.50.0080.01015.86
7.2.40.0060.01115.84
7.2.30.0090.00715.82
7.2.20.0060.01016.02
7.2.10.0030.01115.87
7.2.00.0090.01415.84
7.1.330.0000.01015.89
7.1.320.0100.00715.70
7.1.310.0030.01015.97
7.1.300.0040.01115.64
7.1.290.0070.01015.79
7.1.280.0130.00914.82
7.1.270.0060.01014.73
7.1.260.0110.00415.05
7.1.250.0100.00814.92

preferences:
40.39 ms | 403 KiB | 5 Q