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) { } else { $len = strlen($beforeDot); if ($len <= $exp) { return $beforeDot.($afterDot !== '0' ? $afterDot : '').str_repeat('0', $exp - $len).'i'; } } var_dump($beforeDot, $afterDot); } var_dump(convertFloat(1.004e+300));

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.70.0000.01516.38
8.3.60.0150.00418.11
8.3.50.0100.00721.15
8.3.40.0070.00718.54
8.3.30.0110.00320.34
8.3.20.0070.00020.34
8.3.10.0080.00021.80
8.3.00.0080.00022.31
8.2.190.0180.00416.63
8.2.180.0110.00416.75
8.2.170.0040.01122.96
8.2.160.0140.00020.47
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0160.00326.16
8.2.120.0030.00519.54
8.2.110.0050.00522.26
8.2.100.0120.00017.72
8.2.90.0000.00917.75
8.2.80.0080.00018.79
8.2.70.0050.00318.05
8.2.60.0000.00817.63
8.2.50.0060.00317.63
8.2.40.0030.00519.22
8.2.30.0040.00418.16
8.2.20.0070.00017.67
8.2.10.0040.00417.75
8.2.00.0090.00017.47
8.1.280.0150.00325.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00323.96
8.1.230.0070.00419.15
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0000.00817.25
8.1.190.0030.00619.01
8.1.180.0080.00018.10
8.1.170.0060.00318.96
8.1.160.0070.00319.02
8.1.150.0000.00718.63
8.1.140.0030.00517.51
8.1.130.0030.00317.84
8.1.120.0000.00717.48
8.1.110.0040.00417.49
8.1.100.0070.00017.51
8.1.90.0040.00417.49
8.1.80.0000.00717.49
8.1.70.0000.00717.46
8.1.60.0000.00817.49
8.1.50.0060.00317.56
8.1.40.0030.00617.50
8.1.30.0070.00017.62
8.1.20.0050.00317.66
8.1.10.0040.00417.51
8.1.00.0000.01217.31
8.0.300.0000.00721.56
8.0.290.0000.00716.75
8.0.280.0050.00318.57
8.0.270.0050.00217.31
8.0.260.0030.00316.88
8.0.250.0030.00316.99
8.0.240.0000.00816.97
8.0.230.0030.00316.95
8.0.220.0070.00016.84
8.0.210.0030.00316.81
8.0.200.0030.00316.98
8.0.190.0000.00816.86
8.0.180.0040.00416.97
8.0.170.0040.00416.87
8.0.160.0030.00316.87
8.0.150.0040.00416.86
8.0.140.0100.00016.76
8.0.130.0030.00313.29
8.0.120.0040.00416.94
8.0.110.0050.00216.91
8.0.100.0000.00716.82
8.0.90.0040.00416.93
8.0.80.0090.00916.97
8.0.70.0040.00416.87
8.0.60.0060.00316.94
8.0.50.0000.00916.79
8.0.30.0090.01217.11
8.0.20.0080.01117.40
8.0.10.0040.00416.93
8.0.00.0090.00916.80
7.4.330.0020.00215.00
7.4.320.0030.00316.65
7.4.300.0040.00416.41
7.4.290.0030.00316.54
7.4.280.0030.00316.50
7.4.270.0070.00016.54
7.4.260.0000.00816.64
7.4.250.0070.00016.53
7.4.240.0020.00616.64
7.4.230.0030.00316.32
7.4.220.0160.00316.59
7.4.210.0060.00816.55
7.4.200.0050.00216.65
7.4.190.0080.00016.44
7.4.160.0150.00316.68
7.4.150.0120.00417.40
7.4.140.0120.00717.86
7.4.130.0120.00516.59
7.4.120.0060.01016.54
7.4.110.0130.00616.53
7.4.100.0130.00316.58
7.4.90.0090.00916.64
7.4.80.0080.01219.39
7.4.70.0150.00316.58
7.4.60.0120.00316.50
7.4.50.0000.00516.33
7.4.40.0030.01022.77
7.4.30.0090.01116.45
7.4.00.0030.01014.88
7.3.330.0000.00513.16
7.3.320.0030.00213.40
7.3.310.0060.00316.36
7.3.300.0000.00716.26
7.3.290.0090.00916.37
7.3.280.0060.01016.37
7.3.270.0030.01417.40
7.3.260.0130.00616.21
7.3.250.0090.00916.49
7.3.240.0090.00916.33
7.3.230.0100.00616.52
7.3.210.0030.01316.26
7.3.200.0110.00619.39
7.3.190.0140.00816.72
7.3.180.0150.00816.44
7.3.170.0060.01216.36
7.3.160.0090.00616.33
7.3.120.0090.00614.74
7.2.330.0090.00916.49
7.2.320.0040.01416.79
7.2.310.0090.01216.49
7.2.300.0060.00916.80
7.2.290.0060.00916.57
7.2.00.0030.01019.25
7.1.100.0100.00317.92
7.1.70.0000.01217.26
7.1.60.0070.01719.40
7.1.50.0100.01016.93
7.1.00.0000.03722.36
7.0.200.0030.00616.70
7.0.140.0000.07022.02
7.0.60.0130.08020.04
7.0.50.0000.04317.88
7.0.40.0100.09020.11
7.0.30.0200.04720.09
7.0.20.0230.08320.20
7.0.10.0370.05020.22
7.0.00.0070.08320.08
5.6.280.0000.07721.09
5.6.210.0070.05720.56
5.6.200.0030.08018.16
5.6.190.0100.08320.51
5.6.180.2770.04320.64
5.6.170.0230.04020.46
5.6.160.0030.04020.51
5.6.150.0070.06718.27
5.6.140.0030.04318.16
5.6.130.0030.05018.13
5.6.120.0070.08721.03
5.6.110.0100.08321.13
5.6.100.0100.05320.99
5.6.90.0070.06321.01
5.6.80.0070.08020.43
5.6.70.0130.08320.52
5.5.350.0130.06720.42
5.5.340.0070.08318.05
5.5.330.0170.07320.28
5.5.320.0270.03320.31
5.5.310.0270.06020.37
5.5.300.0030.04717.95
5.5.290.0070.04717.95
5.5.280.0070.04020.75
5.5.270.0070.03720.80
5.5.260.0070.06720.88
5.5.250.0170.07320.60
5.5.240.0130.07720.35
5.4.450.0830.06019.58
5.4.440.0800.05719.40
5.4.430.0430.05019.57
5.4.420.0830.05319.30
5.4.410.0770.05019.07
5.4.400.0170.06718.84
5.4.390.1630.04718.79
5.4.380.0900.05018.74
5.4.370.0170.05018.84
5.4.360.0200.04718.84
5.4.350.0070.03512.03
5.4.340.0100.04112.02
5.4.320.0090.03412.51
5.4.310.0070.03812.51
5.4.300.0100.04612.52
5.4.290.0060.04412.51
5.4.280.0070.04112.40
5.4.270.0080.03412.40
5.4.260.0100.03512.41
5.4.250.0100.05018.95
5.4.240.0130.05018.87
5.4.230.0100.05018.82
5.4.220.0130.05018.93
5.4.210.0000.06019.09
5.4.200.0070.07719.09
5.4.190.0130.04718.95
5.4.180.0170.06018.74
5.4.170.0000.06018.93
5.4.160.0130.05718.78
5.4.150.0030.06319.07
5.4.140.0070.05716.55
5.4.130.0130.04016.48
5.4.120.0170.05716.38
5.4.110.0030.05316.58
5.4.100.0070.04716.64
5.4.90.0070.07316.34
5.4.80.0030.05316.62
5.4.70.0200.06016.63
5.4.60.0070.05016.49
5.4.50.0070.04716.59
5.4.40.0000.05716.51
5.4.30.0100.05716.61
5.4.20.0070.05016.47
5.4.10.0100.05716.34
5.4.00.0100.05015.94
5.3.290.0070.04412.80
5.3.280.0130.04314.58
5.3.270.0030.06014.70
5.3.260.0130.05014.59
5.3.250.0100.07314.64
5.3.240.0070.05014.64
5.3.230.0170.05714.70
5.3.220.0130.04714.58
5.3.210.0030.05714.48
5.3.200.0030.07714.66
5.3.190.0170.04014.75
5.3.180.0070.06014.64
5.3.170.0030.05714.65
5.3.160.0070.06314.60
5.3.150.0170.05314.54
5.3.140.0100.05014.65
5.3.130.0030.05714.55
5.3.120.0030.08014.53
5.3.110.0200.04014.63
5.3.100.0070.06714.06
5.3.90.0130.04313.86
5.3.80.0100.06014.21
5.3.70.0100.04714.10
5.3.60.0230.03714.10
5.3.50.0100.06714.13
5.3.40.0030.06713.87
5.3.30.0070.05013.99
5.3.20.0030.05313.54
5.3.10.0200.05713.75
5.3.00.0000.05313.73
5.2.170.0030.06311.38
5.2.160.0070.04711.16
5.2.150.0030.04711.23
5.2.140.0100.03711.24
5.2.130.0030.04011.07
5.2.120.0100.05011.09
5.2.110.0030.04311.02
5.2.100.0070.04011.21
5.2.90.0030.04011.19
5.2.80.0000.07011.09
5.2.70.0130.05311.06
5.2.60.0030.04311.23
5.2.50.0100.03711.22
5.2.40.0070.04011.10
5.2.30.0030.05011.06
5.2.20.0100.05011.14
5.2.10.0030.04310.84
5.2.00.0070.03710.57
5.1.60.0030.03310.01
5.1.50.0030.03310.05
5.1.40.0130.0279.95
5.1.30.0070.03310.25
5.1.20.0000.06310.33
5.1.10.0030.03710.11
5.1.00.0130.04310.15
5.0.50.0130.0208.54
5.0.40.0000.0308.35
5.0.30.0070.0408.30
5.0.20.0070.0238.36
5.0.10.0030.0278.20
5.0.00.0070.0508.10
4.4.90.0030.0337.42
4.4.80.0030.0237.42
4.4.70.0030.0207.42
4.4.60.0030.0207.42
4.4.50.0000.0237.42
4.4.40.0000.0337.42
4.4.30.0070.0177.42
4.4.20.0000.0237.42
4.4.10.0030.0207.42
4.4.00.0070.0277.42
4.3.110.0130.0137.42
4.3.100.0000.0237.42
4.3.90.0000.0237.42
4.3.80.0070.0307.42
4.3.70.0000.0207.42
4.3.60.0030.0207.42
4.3.50.0000.0337.42
4.3.40.0000.0377.42
4.3.30.0000.0237.42
4.3.20.0030.0207.42
4.3.10.0030.0207.42
4.3.00.0070.0276.65

preferences:
41.12 ms | 401 KiB | 5 Q