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); 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.0060.01218.17
8.3.50.0130.00621.09
8.3.40.0040.01118.89
8.3.30.0100.00320.17
8.3.20.0070.00020.20
8.3.10.0060.00321.92
8.3.00.0000.00822.51
8.2.180.0040.01116.63
8.2.170.0060.00922.96
8.2.160.0120.00320.45
8.2.150.0030.00524.18
8.2.140.0000.00824.66
8.2.130.0130.00326.16
8.2.120.0080.00019.43
8.2.110.0060.00321.06
8.2.100.0080.00417.72
8.2.90.0090.00017.84
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0110.00017.78
8.2.50.0040.00418.07
8.2.40.0000.00718.22
8.2.30.0000.00717.96
8.2.20.0070.00017.51
8.2.10.0070.00017.63
8.2.00.0030.00617.66
8.1.280.0140.00325.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0040.00422.24
8.1.230.0000.01221.04
8.1.220.0080.00017.74
8.1.210.0060.00318.77
8.1.200.0080.00017.23
8.1.190.0000.00817.41
8.1.180.0030.00618.82
8.1.170.0040.00418.51
8.1.160.0000.00722.14
8.1.150.0040.00418.62
8.1.140.0070.00017.40
8.1.130.0000.00717.82
8.1.120.0040.00417.38
8.1.110.0000.00817.37
8.1.100.0000.00817.38
8.1.90.0040.00417.45
8.1.80.0070.00017.48
8.1.70.0030.00317.44
8.1.60.0000.00817.65
8.1.50.0040.00417.59
8.1.40.0030.00617.56
8.1.30.0000.00817.62
8.1.20.0060.00317.65
8.1.10.0050.00317.32
8.1.00.0100.00017.43
8.0.300.0000.00720.15
8.0.290.0040.00416.63
8.0.280.0000.00718.31
8.0.270.0000.00717.13
8.0.260.0030.00316.84
8.0.250.0030.00316.96
8.0.240.0000.00816.95
8.0.230.0000.00716.89
8.0.220.0000.00716.78
8.0.210.0030.00316.84
8.0.200.0070.00016.81
8.0.190.0040.00416.82
8.0.180.0080.00016.87
8.0.170.0000.00816.87
8.0.160.0030.00416.75
8.0.150.0030.00316.74
8.0.140.0130.00016.82
8.0.130.0000.00613.27
8.0.120.0080.00016.65
8.0.110.0040.00416.85
8.0.100.0040.00416.71
8.0.90.0030.00516.70
8.0.80.0060.00916.79
8.0.70.0050.00316.86
8.0.60.0030.00516.65
8.0.50.0000.00816.79
8.0.30.0110.01116.90
8.0.20.0100.01017.40
8.0.10.0040.00416.90
8.0.00.0080.01016.74
7.4.330.0050.00015.00
7.4.320.0000.00716.65
7.4.300.0030.00316.66
7.4.290.0000.00716.63
7.4.280.0030.00316.54
7.4.270.0000.00716.57
7.4.260.0070.00016.35
7.4.250.0070.00016.36
7.4.240.0020.00516.45
7.4.230.0030.00316.55
7.4.220.0060.01216.60
7.4.210.0060.00916.49
7.4.200.0000.00716.57
7.4.190.0040.00416.55
7.4.160.0160.00016.67
7.4.150.0040.01217.40
7.4.140.0120.00817.86
7.4.130.0130.01016.56
7.4.120.0090.00816.45
7.4.110.0160.00716.55
7.4.100.0070.01116.64
7.4.90.0100.01316.52
7.4.80.0030.02019.39
7.4.70.0100.00716.26
7.4.60.0030.01216.62
7.4.50.0070.00316.59
7.4.40.0040.01222.77
7.4.30.0090.01616.26
7.4.00.0100.00714.61
7.3.330.0050.00013.34
7.3.320.0000.00513.30
7.3.310.0070.00016.37
7.3.300.0030.00316.32
7.3.290.0070.00716.29
7.3.280.0060.01116.29
7.3.270.0100.01317.40
7.3.260.0120.00616.52
7.3.250.0080.00816.55
7.3.240.0090.00716.27
7.3.230.0100.00616.39
7.3.210.0080.00816.23
7.3.200.0090.00619.39
7.3.190.0090.00116.32
7.3.180.0090.01516.64
7.3.170.0030.01416.45
7.3.160.0090.00616.32
7.3.120.0070.01015.05
7.3.10.0030.00916.61
7.3.00.0070.00716.73
7.2.330.0130.00616.64
7.2.320.0090.01016.57
7.2.310.0080.01116.67
7.2.300.0130.01016.72
7.2.290.0060.00916.76
7.2.130.0080.00316.61
7.2.120.0000.01316.71
7.2.110.0030.00916.77
7.2.100.0070.00716.98
7.2.90.0070.00716.95
7.2.80.0120.00416.49
7.2.70.0030.00617.07
7.2.60.0030.01016.60
7.2.50.0040.00416.93
7.2.40.0080.00816.92
7.2.30.0060.00616.73
7.2.20.0090.00616.81
7.2.10.0040.01216.78
7.2.00.0070.01018.05
7.1.250.0030.01015.95
7.1.200.0060.00315.93
7.1.100.0140.00917.96
7.1.70.0030.00617.02
7.1.60.0070.01719.40
7.1.50.0060.01616.98
7.1.00.0030.03322.48
7.0.200.0000.00716.66
7.0.140.0030.07021.93
7.0.60.0130.08319.80
7.0.50.0070.08017.90
7.0.40.0100.05320.04
7.0.30.0230.05020.25
7.0.20.0170.04320.19
7.0.10.0100.04720.33
7.0.00.0070.05320.12
5.6.280.0030.07321.00
5.6.210.0100.06320.65
5.6.200.0030.08718.14
5.6.190.0070.04320.33
5.6.180.0300.04720.61
5.6.170.0370.05320.46
5.6.160.0100.05320.50
5.6.150.0030.04318.29
5.6.140.0070.05318.15
5.6.130.0000.08718.27
5.6.120.0070.06321.04
5.6.110.0100.07720.99
5.6.100.0130.06721.15
5.6.90.0030.07721.13
5.6.80.0070.06720.50
5.5.350.0230.08020.51
5.5.340.0100.08017.95
5.5.330.0000.04320.57
5.5.320.2830.04720.32
5.5.310.0300.04320.20
5.5.300.0100.05017.98
5.5.290.0030.08717.95
5.5.280.0000.04720.99
5.5.270.0070.06320.76
5.5.260.0070.07720.88
5.5.250.0030.04020.80
5.5.240.0130.07020.30
5.4.450.0570.05719.58
5.4.440.0830.06019.47
5.4.430.0070.05719.46
5.4.420.0600.06719.59
5.4.410.0800.07019.46
5.4.400.0670.05319.27
5.4.390.0800.05019.36
5.4.380.0870.05718.73
5.4.370.0100.05718.78
5.4.360.0230.04318.77
5.4.350.0040.04512.03
5.4.340.0110.03412.02
5.4.320.0070.04312.51
5.4.310.0080.03612.51
5.4.300.0080.03912.51
5.4.290.0090.03812.51
5.4.280.0060.03812.41
5.4.270.0040.03712.40
5.4.260.0110.03512.41
5.4.250.0130.05018.83
5.4.240.0100.07318.76
5.4.230.0030.05318.87
5.4.220.0070.06318.99
5.4.210.0170.05318.65
5.4.200.0070.06018.83
5.4.190.0070.05718.91
5.4.180.0230.04319.08
5.4.170.0070.07019.08
5.4.160.0130.04718.94
5.4.150.0100.05318.74
5.4.140.0170.04716.55
5.4.130.0030.06016.30
5.4.120.0100.05316.27
5.4.110.0130.07016.47
5.4.100.0070.06016.47
5.4.90.0130.04316.64
5.4.80.0130.04716.59
5.4.70.0100.06316.54
5.4.60.0170.06316.44
5.4.50.0030.05316.62
5.4.40.0100.04716.49
5.4.30.0100.05016.61
5.4.20.0230.05016.39
5.4.10.0170.06316.28
5.4.00.0130.06015.88
5.3.290.0080.04012.80
5.3.280.0100.07014.61
5.3.270.0070.05714.52
5.3.260.0130.06714.76
5.3.250.0030.06014.70
5.3.240.0070.06714.71
5.3.230.0070.05714.68
5.3.220.0100.07014.64
5.3.210.0230.06714.41
5.3.200.0100.04714.74
5.3.190.0100.05014.66
5.3.180.0030.07714.79
5.3.170.0100.05714.57
5.3.160.0130.05014.66
5.3.150.0000.06014.73
5.3.140.0130.04314.79
5.3.130.0070.06014.72
5.3.120.0030.06314.58
5.3.110.0100.06314.52
5.3.100.0130.06014.06
5.3.90.0100.05014.09
5.3.80.0130.06714.20
5.3.70.0070.06014.02
5.3.60.0070.07014.01
5.3.50.0100.05713.93
5.3.40.0170.06314.04
5.3.30.0130.06314.11
5.3.20.0030.06013.78
5.3.10.0200.07013.74
5.3.00.0000.07013.87
5.2.170.0100.06311.06
5.2.160.0070.05011.24
5.2.150.0030.06310.98
5.2.140.0100.05310.98
5.2.130.0100.04011.19
5.2.120.0100.04710.95
5.2.110.0130.04011.33
5.2.100.0030.06011.18
5.2.90.0030.05011.29
5.2.80.0030.06311.07
5.2.70.0100.05011.09
5.2.60.0070.05311.05
5.2.50.0130.05011.11
5.2.40.0170.03311.10
5.2.30.0070.04311.20
5.2.20.0030.05711.04
5.2.10.0030.04310.70
5.2.00.0030.06010.72
5.1.60.0130.0279.99
5.1.50.0030.04710.06
5.1.40.0030.03710.10
5.1.30.0130.04710.43
5.1.20.0100.05010.33
5.1.10.0070.04010.09
5.1.00.0100.03710.32
5.0.50.0030.0338.62
5.0.40.0070.0238.27
5.0.30.0070.0608.39
5.0.20.0100.0278.30
5.0.10.0170.0408.11
5.0.00.0000.0508.16
4.4.90.0100.0237.42
4.4.80.0030.0237.42
4.4.70.0070.0277.42
4.4.60.0070.0207.42
4.4.50.0170.0177.42
4.4.40.0000.0407.42
4.4.30.0000.0237.42
4.4.20.0070.0277.42
4.4.10.0100.0177.42
4.4.00.0030.0477.42
4.3.110.0030.0277.42
4.3.100.0000.0307.42
4.3.90.0070.0237.42
4.3.80.0030.0337.42
4.3.70.0000.0237.42
4.3.60.0030.0277.42
4.3.50.0000.0277.42
4.3.40.0030.0337.42
4.3.30.0000.0277.42
4.3.20.0000.0237.42
4.3.10.0000.0307.42
4.3.00.0170.0208.10

preferences:
30.34 ms | 401 KiB | 5 Q