3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bytes_to_int($size) { var_dump($size); // Remove the non-unit characters from the size. $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-numeric characters from the size. $size = preg_replace('/[^0-9\.]/', '', $size); if ($unit) { var_dump(round($size * pow(1024, stripos('bkmgtpezy', $unit[0])))); } else { var_dump(round($size)); } print "\n\n"; } bytes_to_int('12,2'); bytes_to_int('12,2 b'); bytes_to_int(''); bytes_to_int('m');

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.0120.00616.99
8.5.00.0150.00722.20
8.4.150.0020.00014.05
8.4.140.0080.01418.01
8.4.130.0110.01017.83
8.4.120.0130.00720.68
8.4.110.0110.00918.80
8.4.100.0120.00918.19
8.4.90.0140.00818.02
8.4.80.0070.00919.95
8.4.70.0050.00319.89
8.4.60.0080.00920.66
8.4.50.0100.01020.47
8.4.40.0160.00317.91
8.4.30.0060.00920.39
8.4.20.0060.00325.84
8.4.10.0050.00519.55
8.3.280.0120.00918.75
8.3.270.0110.00916.59
8.3.260.0090.01016.71
8.3.250.0120.00718.83
8.3.240.0100.01016.80
8.3.230.0150.00416.99
8.3.220.0060.00218.79
8.3.210.0120.00916.91
8.3.200.0060.00216.75
8.3.190.0120.00617.03
8.3.180.0100.00916.67
8.3.170.0160.00320.58
8.3.160.0080.01117.35
8.3.150.0100.01017.39
8.3.140.0080.00016.98
8.3.130.0000.00918.53
8.3.120.0080.00018.99
8.3.110.0040.00416.95
8.3.100.0030.00620.16
8.3.90.0030.01326.77
8.3.80.0060.00316.88
8.3.70.0150.00618.68
8.3.60.0180.00017.00
8.3.50.0100.00924.52
8.3.40.0090.00618.92
8.3.30.0070.01118.96
8.3.20.0070.00024.18
8.3.10.0030.00624.66
8.3.00.0040.00426.16
8.2.290.0050.00318.97
8.2.280.0130.00618.49
8.2.270.0040.00419.22
8.2.260.0070.00717.00
8.2.250.0040.00416.88
8.2.240.0130.00618.51
8.2.230.0040.00420.94
8.2.220.0040.01124.06
8.2.210.0080.00026.77
8.2.200.0060.00316.75
8.2.190.0100.01016.88
8.2.180.0190.00025.92
8.2.170.0070.00719.14
8.2.160.0100.00322.96
8.2.150.0050.00325.66
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00926.35
8.2.110.0060.00322.14
8.2.100.0000.01217.97
8.2.90.0040.00418.03
8.2.80.0080.00017.97
8.2.70.0040.00418.05
8.2.60.0000.01019.88
8.2.50.0000.00818.10
8.2.40.0040.00419.43
8.2.30.0060.00319.26
8.2.20.0040.00418.10
8.2.10.0070.00019.34
8.2.00.0000.00819.22
8.1.330.0120.00716.76
8.1.320.0080.00516.61
8.1.310.0080.00616.78
8.1.300.0080.01120.34
8.1.290.0080.00030.84
8.1.280.0040.01125.92
8.1.270.0040.00423.99
8.1.260.0000.00828.09
8.1.250.0040.00428.09
8.1.240.0000.01317.61
8.1.230.0030.00722.80
8.1.220.0040.00417.74
8.1.210.0060.00318.92
8.1.200.0000.01017.47
8.1.190.0050.00317.35
8.1.180.0000.00918.10
8.1.170.0030.00718.69
8.1.160.0040.00418.99
8.1.150.0040.00418.78
8.1.140.0000.00718.90
8.1.130.0000.00817.60
8.1.120.0080.00017.61
8.1.110.0040.00417.45
8.1.100.0080.00017.57
8.1.90.0000.00717.53
8.1.80.0100.00017.61
8.1.70.0000.00717.57
8.1.60.0030.00617.64
8.1.50.0040.00417.69
8.1.40.0040.00417.57
8.1.30.0050.00517.76
8.1.20.0000.00817.73
8.1.10.0000.00817.75
8.1.00.0100.00017.67
8.0.300.0000.00719.80
8.0.290.0080.00017.00
8.0.280.0000.00718.48
8.0.270.0030.00317.04
8.0.260.0000.00717.05
8.0.250.0070.00017.18
8.0.240.0030.00317.12
8.0.230.0050.00217.14
8.0.220.0000.00616.97
8.0.210.0070.00017.02
8.0.200.0070.00017.13
8.0.190.0040.00417.13
8.0.180.0030.00517.07
8.0.170.0000.00817.11
8.0.160.0000.00717.04
8.0.150.0000.00717.01
8.0.140.0000.00717.02
8.0.130.0000.00613.49
8.0.120.0040.00417.08
8.0.110.0030.00517.04
8.0.100.0040.00416.94
8.0.90.0070.00016.91
8.0.80.0050.00916.99
8.0.70.0040.00417.05
8.0.60.0000.00817.05
8.0.50.0050.00317.13
8.0.30.0110.00417.32
8.0.20.0110.00917.17
8.0.10.0000.00717.20
8.0.00.0110.00717.18
7.4.330.0000.00415.55
7.4.320.0030.00316.69
7.4.300.0000.00616.71
7.4.290.0030.00316.84
7.4.280.0050.00316.71
7.4.270.0060.00616.82
7.4.260.0050.00013.52
7.4.250.0050.00316.78
7.4.240.0030.00316.64
7.4.230.0040.00416.73
7.4.220.0050.00216.80
7.4.210.0090.00716.85
7.4.200.0050.00216.74
7.4.130.0070.01216.79
7.4.120.0090.00916.78
7.4.110.0080.00816.64
7.4.100.0100.00716.89
7.4.90.0060.01116.89
7.4.80.0070.01116.73
7.4.70.0060.01216.82
7.4.60.0060.01216.61
7.4.50.0160.00316.82
7.4.40.0090.01216.60
7.4.30.0110.01316.43
7.4.20.0070.01716.57
7.4.10.0170.00716.59
7.4.00.0140.00316.75
7.3.330.0020.00516.70
7.3.320.0050.00013.35
7.3.310.0040.00416.59
7.3.300.0030.00316.61
7.3.290.0120.00616.52
7.3.280.0060.01316.55
7.3.260.0160.00816.77
7.3.230.0120.01216.57
7.3.210.0080.00816.78
7.3.200.0040.01416.53
7.3.190.0060.01316.75
7.3.180.0080.00816.87
7.3.170.0050.01316.70
7.3.160.0130.00416.61
7.3.150.0170.00516.36
7.3.140.0080.01216.59
7.3.130.0030.01416.53
7.3.120.0100.01316.36
7.3.110.0150.00516.84
7.3.100.0160.00716.75
7.3.90.0120.01216.55
7.3.80.0140.00916.69
7.3.70.0170.00616.64
7.3.60.0040.01316.59
7.3.50.0070.01616.38
7.3.40.0040.01516.59
7.3.30.0120.00616.76
7.3.20.0070.01116.45
7.3.10.0180.00316.68
7.3.00.0170.00016.63
7.2.330.0090.01616.93
7.2.320.0100.00716.80
7.2.310.0100.01016.63
7.2.300.0190.00916.81
7.2.290.0110.01116.72
7.2.280.0140.01016.73
7.2.270.0190.00416.78
7.2.260.0100.01316.96
7.2.250.0110.01116.96
7.2.240.0180.00416.75
7.2.230.0130.01316.67
7.2.220.0120.00616.63
7.2.210.0130.01116.76
7.2.200.0130.00516.89
7.2.190.0050.01616.70
7.2.180.0090.00916.80
7.2.170.0120.00916.76
7.2.160.0060.01216.63
7.2.150.0170.00316.68
7.2.140.0050.01316.75
7.2.130.0150.00416.93
7.2.120.0090.00916.88
7.2.110.0090.00916.74
7.2.100.0150.00316.79
7.2.90.0140.00416.91
7.2.80.0130.00916.80
7.2.70.0190.00816.77
7.2.60.0170.00716.56
7.2.50.0060.01416.94
7.2.40.0150.00517.05
7.2.30.0540.00416.64
7.2.20.0150.00516.81
7.2.10.0110.01116.81
7.2.00.0100.00816.66

preferences:
173.24 ms | 403 KiB | 5 Q