3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertFloat($float) { $float = (string)$float; $expPos = strpos($float, 'E'); if ($expPos === false) { return $float; } $beforeDot = '0'; // Well, fuck you my English. $afterDot = '0'; // ^^ $numberWithoutPrecision = substr($float, 0, $expPos); $exp = (int)substr($float, $expPos + 1, strlen($float)); if ($exp === 0) { return '1'; } $dotPos = strpos($numberWithoutPrecision, '.'); if ($dotPos === false) { $beforeDot = $numberWithoutPrecision; } else { $beforeDot = substr($numberWithoutPrecision, 0, $dotPos); $afterDot = substr($numberWithoutPrecision, $dotPos + 1, strlen($numberWithoutPrecision)); } if ($exp < 0) { $len = strlen($afterDot); if ($len <= $exp) { return $beforeDot.$afterDot; } } else { $len = strlen($beforeDot); var_dump($len); //return $beforeDot.($afterDot !== '0' ? $afterDot : '').str_repeat('0', $exp - $len).'i'; } var_dump($beforeDot, $afterDot); } var_dump(convertFloat(1.0104e+5));

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.00418.30
8.3.50.0060.01021.02
8.3.40.0120.00318.63
8.3.30.0130.00020.17
8.3.20.0000.00820.34
8.3.10.0040.00421.92
8.3.00.0100.00022.52
8.2.180.0090.00616.50
8.2.170.0140.00022.96
8.2.160.0150.00020.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0110.00726.16
8.2.120.0000.00819.65
8.2.110.0070.00422.23
8.2.100.0130.00019.41
8.2.90.0050.00318.91
8.2.80.0000.00719.29
8.2.70.0050.00317.25
8.2.60.0030.00918.04
8.2.50.0040.00418.07
8.2.40.0000.00818.09
8.2.30.0000.00718.00
8.2.20.0040.00417.71
8.2.10.0000.00817.55
8.2.00.0090.00017.62
8.1.280.0140.00725.92
8.1.270.0040.00420.27
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0060.00323.96
8.1.230.0040.00719.00
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0100.00017.23
8.1.190.0040.00417.51
8.1.180.0030.00718.87
8.1.170.0040.00418.39
8.1.160.0000.00722.14
8.1.150.0040.00418.69
8.1.140.0060.00317.27
8.1.130.0070.00017.79
8.1.120.0040.00417.45
8.1.110.0000.00717.45
8.1.100.0040.00417.36
8.1.90.0040.00417.37
8.1.80.0000.00717.38
8.1.70.0000.00717.42
8.1.60.0060.00317.58
8.1.50.0090.00017.58
8.1.40.0040.00417.52
8.1.30.0040.00417.68
8.1.20.0040.00417.70
8.1.10.0040.00417.50
8.1.00.0070.00417.23
8.0.300.0070.00018.77
8.0.290.0020.00517.15
8.0.280.0030.00318.30
8.0.270.0000.00817.08
8.0.260.0080.00016.82
8.0.250.0070.00016.96
8.0.240.0040.00416.81
8.0.230.0000.00716.80
8.0.220.0000.00716.77
8.0.210.0070.00016.83
8.0.200.0000.00616.79
8.0.190.0070.00016.94
8.0.180.0000.00716.86
8.0.170.0040.00416.77
8.0.160.0030.00616.79
8.0.150.0040.00416.80
8.0.140.0110.00016.84
8.0.130.0070.00013.20
8.0.120.0000.00816.82
8.0.110.0040.00416.80
8.0.100.0000.00716.84
8.0.90.0040.00416.66
8.0.80.0090.00616.89
8.0.70.0040.00416.91
8.0.60.0050.00316.87
8.0.50.0000.00816.78
8.0.30.0110.00717.04
8.0.20.0160.00817.40
8.0.10.0000.00716.78
8.0.00.0080.01116.73
7.4.330.0020.00215.00
7.4.320.0030.00316.60
7.4.300.0030.00316.51
7.4.290.0000.00716.42
7.4.280.0030.00516.50
7.4.270.0000.00716.59
7.4.260.0080.00016.51
7.4.250.0070.00016.46
7.4.240.0030.00516.56
7.4.230.0000.00716.41
7.4.220.0210.01416.46
7.4.210.0060.00716.58
7.4.200.0070.00016.50
7.4.190.0080.00016.75
7.4.160.0130.00316.45
7.4.150.0030.01417.40
7.4.140.0110.00917.86
7.4.130.0110.00716.49
7.4.120.0110.00616.63
7.4.110.0030.01316.59
7.4.100.0060.01616.70
7.4.90.0110.00716.43
7.4.80.0060.01619.39
7.4.70.0030.01316.34
7.4.60.0070.01116.53
7.4.50.0000.00816.31
7.4.40.0110.00722.77
7.4.30.0150.00516.51
7.4.00.0060.00914.81
7.3.330.0030.00313.34
7.3.320.0050.00013.18
7.3.310.0050.00316.41
7.3.300.0030.00316.34
7.3.290.0080.00616.34
7.3.280.0090.00716.38
7.3.270.0110.00617.40
7.3.260.0080.00816.26
7.3.250.0080.00916.51
7.3.240.0030.01316.53
7.3.230.0030.01416.39
7.3.210.0080.01016.59
7.3.200.0110.00719.39
7.3.190.0060.01416.66
7.3.180.0150.00616.38
7.3.170.0100.00716.71
7.3.160.0100.00616.52
7.3.120.0100.00714.86
7.3.110.0070.01214.93
7.3.100.0090.00614.72
7.3.90.0030.00914.88
7.3.80.0070.00514.98
7.3.70.0030.01014.69
7.3.60.0080.00614.87
7.3.50.0040.00914.80
7.3.40.0070.00614.77
7.3.30.0020.01014.86
7.3.20.0080.00616.70
7.3.10.0080.00716.38
7.3.00.0050.00816.72
7.2.330.0040.01416.29
7.2.320.0110.00716.66
7.2.310.0100.01016.70
7.2.300.0070.01016.35
7.2.290.0090.00616.69
7.2.250.0040.01314.91
7.2.240.0070.01314.81
7.2.230.0060.00815.04
7.2.220.0050.00614.84
7.2.210.0020.01214.81
7.2.200.0000.01115.01
7.2.190.0030.01115.05
7.2.180.0030.01215.14
7.2.170.0060.00814.95
7.2.130.0040.01116.97
7.2.120.0090.00016.68
7.2.110.0000.01316.71
7.2.100.0040.01216.64
7.2.90.0000.00916.79
7.2.80.0090.00617.02
7.2.70.0090.00616.87
7.2.60.0070.00416.99
7.2.50.0030.01316.67
7.2.40.0060.01016.65
7.2.30.0100.00716.98
7.2.20.0000.01216.66
7.2.10.0030.01316.95
7.2.00.0020.01017.89
7.1.330.0060.00815.93
7.1.320.0050.00615.75
7.1.310.0050.01015.73
7.1.300.0060.00515.81
7.1.290.0080.00615.76
7.1.280.0020.00815.84
7.1.270.0060.00615.75
7.1.260.0000.01115.79
7.1.250.0060.00615.73
7.1.100.0110.00417.98
7.1.70.0070.00317.10
7.1.60.0110.01419.40
7.1.50.0130.01017.08
7.1.00.0070.03022.40
7.0.200.0000.00816.96
7.0.140.0030.07722.00
7.0.60.0070.08719.84
7.0.50.0030.04017.87
7.0.40.0130.08020.26
7.0.30.0270.05720.26
7.0.20.0230.05320.40
7.0.10.0100.07720.12
7.0.00.0070.07320.12
5.6.280.0030.07321.09
5.6.210.0100.08720.48
5.6.200.0070.08318.19
5.6.190.0100.07320.55
5.6.180.0300.07720.50
5.6.170.0300.04320.51
5.6.160.0030.06020.48
5.6.150.0030.05718.25
5.6.140.0030.04018.23
5.6.130.0030.05318.14
5.6.120.0000.04320.91
5.6.110.0070.08721.12
5.6.100.0030.04321.00
5.6.90.0100.08321.02
5.6.80.0170.07320.40
5.6.70.4470.03320.39
5.5.350.0070.08720.43
5.5.340.0130.07317.95
5.5.330.0100.08020.46
5.5.320.0300.06020.36
5.5.310.0300.03020.23
5.5.300.0000.07317.97
5.5.290.0000.04318.10
5.5.280.0130.08020.91
5.5.270.0100.06720.83
5.5.260.0170.08320.74
5.5.250.0130.08320.47
5.5.240.0170.05020.25
5.4.450.0200.05719.20
5.4.440.0070.06319.30
5.4.430.0270.05019.33
5.4.420.0200.05019.34
5.4.410.0130.05319.46
5.4.400.1200.04718.50
5.4.390.1830.06018.70
5.4.380.0300.06318.57
5.4.370.0100.05318.70
5.4.360.0230.04018.61
5.4.350.0090.03312.03
5.4.340.0130.04812.03
5.4.320.0060.04212.51
5.4.310.0090.03512.50
5.4.300.0070.03512.51
5.4.290.0080.05112.51
5.4.280.0090.03212.41
5.4.270.0070.04412.40
5.4.260.0080.03612.41
5.4.250.0130.05718.79
5.4.240.0070.05718.80
5.4.230.0130.05018.79
5.4.220.0170.06018.65
5.4.210.0100.07718.96
5.4.200.0100.05719.02
5.4.190.0130.06018.75
5.4.180.0100.07019.02
5.4.170.0200.05319.07
5.4.160.0100.05018.99
5.4.150.0070.06018.96
5.4.140.0030.07016.42
5.4.130.0230.05316.34
5.4.120.0130.05316.51
5.4.110.0130.05316.52
5.4.100.0100.05016.40
5.4.90.0030.07716.41
5.4.80.0170.04016.55
5.4.70.0170.04716.50
5.4.60.0170.04316.39
5.4.50.0130.04316.48
5.4.40.0170.04016.52
5.4.30.0070.05016.45
5.4.20.0100.05716.43
5.4.10.0170.04316.58
5.4.00.0170.04315.78
5.3.290.0070.03912.80
5.3.280.0200.06014.77
5.3.270.0070.05714.70
5.3.260.0070.08014.83
5.3.250.0130.05714.68
5.3.240.0100.05714.61
5.3.230.0030.05714.43
5.3.220.0130.06314.64
5.3.210.0070.06014.66
5.3.200.0070.06014.48
5.3.190.0070.05314.48
5.3.180.0030.05314.71
5.3.170.0100.05314.49
5.3.160.0070.05014.40
5.3.150.0170.04014.63
5.3.140.0100.05014.70
5.3.130.0030.05714.38
5.3.120.0100.05314.52
5.3.110.0170.07714.55
5.3.100.0100.04713.95
5.3.90.0100.04314.25
5.3.80.0070.05014.13
5.3.70.0100.04714.05
5.3.60.0070.05014.09
5.3.50.0070.05013.95
5.3.40.0030.05314.04
5.3.30.0100.04313.75
5.3.20.0070.04713.86
5.3.10.0200.06013.73
5.3.00.0030.05013.48
5.2.170.0100.04011.16
5.2.160.0170.03311.14
5.2.150.0100.04011.13
5.2.140.0100.04011.31
5.2.130.0030.04311.27
5.2.120.0070.04011.18
5.2.110.0100.03711.27
5.2.100.0100.03311.16
5.2.90.0100.03711.19
5.2.80.0070.04010.94
5.2.70.0170.03010.93
5.2.60.0130.03311.15
5.2.50.0030.04711.03
5.2.40.0070.03711.00
5.2.30.0030.04711.05
5.2.20.0130.03311.13
5.2.10.0100.04310.85
5.2.00.0100.03310.81
5.1.60.0070.03710.02
5.1.50.0170.02710.08
5.1.40.0070.0379.98
5.1.30.0000.05310.56
5.1.20.0100.03310.35
5.1.10.0130.04310.07
5.1.00.0100.04310.04
5.0.50.0000.0438.52
5.0.40.0000.0338.58
5.0.30.0100.0378.30
5.0.20.0030.0308.26
5.0.10.0030.0308.11
5.0.00.0100.0378.14
4.4.90.0000.0337.48
4.4.80.0000.0237.48
4.4.70.0000.0237.48
4.4.60.0070.0177.48
4.4.50.0000.0237.48
4.4.40.0000.0377.48
4.4.30.0130.0207.48
4.4.20.0070.0237.48
4.4.10.0000.0237.48
4.4.00.0000.0477.48
4.3.110.0000.0277.48
4.3.100.0070.0177.48
4.3.90.0030.0307.48
4.3.80.0100.0277.48
4.3.70.0000.0277.48
4.3.60.0030.0237.48
4.3.50.0070.0207.48
4.3.40.0030.0377.48
4.3.30.0000.0237.48
4.3.20.0030.0237.48
4.3.10.0070.0207.48
4.3.00.0030.0236.65

preferences:
44.31 ms | 401 KiB | 5 Q