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 = ''; // ^^ $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)); $afterDot = rtrim($afterDot, '0'); } if ($exp < 0) { $len = strlen($afterDot); if ($len <= $exp) { return $beforeDot.$afterDot; } } else { $len = strlen($afterDot); if ($len <= $exp) { return $beforeDot.$afterDot.str_repeat('0', $exp - $len).'i'; } else { return $beforeDot.substr($afterDot, 0, $dotPos).'.'.substr($afterDot, $dotPos, strlen($afterDot)); } } var_dump($beforeDot, $afterDot); } var_dump(convertFloat('1.1111111111111111111111111111111111111111111111111111111111110e+60'));

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.0140.00318.18
8.3.50.0100.00521.09
8.3.40.0100.01018.67
8.3.30.0080.00520.30
8.3.20.0060.00320.30
8.3.10.0080.00022.01
8.3.00.0080.00022.50
8.2.180.0110.00416.63
8.2.170.0140.00022.96
8.2.160.0070.00720.34
8.2.150.0080.00024.18
8.2.140.0110.00824.66
8.2.130.0080.00026.16
8.2.120.0090.00019.66
8.2.110.0130.00322.13
8.2.100.0110.00019.26
8.2.90.0050.00319.27
8.2.80.0080.00019.25
8.2.70.0000.00817.63
8.2.60.0040.00418.04
8.2.50.0060.00318.07
8.2.40.0040.00418.28
8.2.30.0000.00818.07
8.2.20.0030.00517.67
8.2.10.0000.00717.82
8.2.00.0040.00417.82
8.1.280.0100.00725.92
8.1.270.0070.00319.96
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0070.00419.21
8.1.220.0000.00917.78
8.1.210.0050.00518.77
8.1.200.0060.00317.47
8.1.190.0050.00317.51
8.1.180.0000.00818.89
8.1.170.0000.00818.57
8.1.160.0000.00822.18
8.1.150.0050.00318.64
8.1.140.0050.00217.33
8.1.130.0080.00017.79
8.1.120.0070.00017.48
8.1.110.0030.00517.55
8.1.100.0040.00417.46
8.1.90.0050.00317.46
8.1.80.0070.00017.54
8.1.70.0000.00717.42
8.1.60.0000.00817.50
8.1.50.0040.00417.43
8.1.40.0050.00317.46
8.1.30.0040.00417.55
8.1.20.0040.00417.50
8.1.10.0000.00717.48
8.1.00.0080.00417.33
8.0.300.0000.00718.77
8.0.290.0000.00817.17
8.0.280.0030.00618.50
8.0.270.0000.00717.28
8.0.260.0050.00316.77
8.0.250.0000.00616.99
8.0.240.0040.00416.94
8.0.230.0040.00416.85
8.0.220.0030.00316.91
8.0.210.0000.00716.93
8.0.200.0000.00616.95
8.0.190.0030.00616.98
8.0.180.0000.00716.92
8.0.170.0000.00816.99
8.0.160.0030.00316.97
8.0.150.0050.00316.88
8.0.140.0030.00716.89
8.0.130.0030.00313.34
8.0.120.0030.00616.75
8.0.110.0030.00516.88
8.0.100.0020.00516.75
8.0.90.0070.00016.73
8.0.80.0100.00716.96
8.0.70.0070.00016.76
8.0.60.0000.00716.97
8.0.50.0040.00416.77
8.0.30.0060.01216.96
8.0.20.0100.00917.40
8.0.10.0040.00417.01
8.0.00.0090.01216.79
7.4.330.0000.00515.00
7.4.320.0070.00016.62
7.4.300.0040.00416.62
7.4.290.0050.00316.56
7.4.280.0000.00716.55
7.4.270.0000.00716.61
7.4.260.0040.00416.56
7.4.250.0000.00716.58
7.4.240.0040.00416.52
7.4.230.0000.00716.54
7.4.220.0150.00616.48
7.4.210.0110.00516.65
7.4.200.0040.00416.43
7.4.190.0070.00016.68
7.4.160.0110.00616.60
7.4.150.0150.00717.40
7.4.140.0090.01117.86
7.4.130.0120.00616.53
7.4.120.0110.00616.56
7.4.110.0060.01016.64
7.4.100.0100.01316.49
7.4.90.0120.00616.49
7.4.80.0080.01419.39
7.4.70.0000.01716.65
7.4.60.0080.00816.50
7.4.50.0070.00016.33
7.4.40.0070.01022.77
7.4.30.0100.01016.51
7.4.10.0160.00315.15
7.4.00.0050.01214.74
7.3.330.0050.00013.19
7.3.320.0050.00013.29
7.3.310.0080.00016.46
7.3.300.0030.00316.24
7.3.290.0070.01116.34
7.3.280.0100.00716.36
7.3.270.0060.01017.40
7.3.260.0110.00616.60
7.3.250.0110.00816.37
7.3.240.0110.00616.52
7.3.230.0090.00916.52
7.3.210.0090.00916.51
7.3.200.0060.00919.39
7.3.190.0070.01516.41
7.3.180.0070.01416.45
7.3.170.0080.00816.55
7.3.160.0110.00816.29
7.3.130.0110.00714.96
7.3.120.0020.01514.87
7.3.110.0100.01015.15
7.3.100.0090.00614.59
7.3.90.0030.00714.72
7.3.80.0000.01215.09
7.3.70.0040.01214.64
7.3.60.0040.01114.62
7.3.50.0030.01014.79
7.3.40.0000.01415.00
7.3.30.0040.01214.95
7.3.20.0140.00716.82
7.3.10.0030.00716.76
7.3.00.0030.01016.70
7.2.330.0100.00716.51
7.2.320.0140.00316.61
7.2.310.0110.01116.63
7.2.300.0030.01316.76
7.2.290.0120.00916.54
7.2.260.0070.01315.17
7.2.250.0000.01914.84
7.2.240.0060.01014.87
7.2.230.0060.00915.11
7.2.220.0100.00715.06
7.2.210.0040.00714.90
7.2.200.0060.00315.18
7.2.190.0030.01015.13
7.2.180.0040.00714.84
7.2.170.0060.00815.07
7.2.160.0070.01115.04
7.2.150.0060.00616.79
7.2.140.0070.00716.78
7.2.130.0090.00617.00
7.2.120.0060.00917.01
7.2.110.0070.00417.03
7.2.100.0040.00716.86
7.2.90.0030.01316.74
7.2.80.0060.00917.09
7.2.70.0030.00616.78
7.2.60.0060.00317.04
7.2.50.0130.00016.95
7.2.40.0080.00417.12
7.2.30.0040.01117.11
7.2.20.0030.00717.05
7.2.10.0000.00916.96
7.2.00.0060.01116.91
7.1.330.0030.01015.94
7.1.320.0070.00715.89
7.1.310.0060.00916.03
7.1.300.0100.00316.00
7.1.290.0060.00615.66
7.1.280.0070.01416.05
7.1.270.0070.01015.82
7.1.260.0030.01015.88
7.1.250.0100.00315.82
7.1.240.0060.00615.82
7.1.230.0040.00415.98
7.1.220.0130.00015.75
7.1.210.0030.00615.71
7.1.200.0000.01315.87
7.1.190.0050.00515.66
7.1.180.0000.01415.92
7.1.170.0030.00715.59
7.1.160.0090.00315.85
7.1.150.0100.00315.73
7.1.140.0070.00716.00
7.1.130.0040.01115.88
7.1.120.0070.00715.68
7.1.110.0070.00715.56
7.1.100.0070.00916.74
7.1.90.0000.01715.68
7.1.80.0000.00915.71
7.1.70.0060.00616.66
7.1.60.0110.00817.57
7.1.50.0090.01116.44
7.1.40.0100.00615.57
7.1.30.0030.01015.80
7.1.20.0060.00615.68
7.1.10.0070.01115.86
7.1.00.0050.02319.16
7.0.330.0060.00315.40
7.0.320.0000.01515.57
7.0.310.0030.00915.37
7.0.300.0030.00915.60
7.0.290.0030.00915.39
7.0.280.0060.00315.64
7.0.270.0040.00415.16
7.0.260.0030.00615.48
7.0.250.0070.00715.48
7.0.240.0080.00815.57
7.0.230.0030.01015.50
7.0.220.0000.01215.50
7.0.210.0090.00615.47
7.0.200.0020.00916.12
7.0.190.0000.00915.51
7.0.180.0030.01315.62
7.0.170.0070.01115.26
7.0.160.0030.01215.54
7.0.150.0070.01115.32
7.0.140.0080.03818.73
7.0.130.0000.01215.29
7.0.120.0100.00615.62
7.0.110.0050.00315.42
7.0.100.0030.00915.56
7.0.90.0030.01015.53
7.0.80.0060.00915.71
7.0.70.0030.01015.42
7.0.60.0110.01817.71
7.0.50.0050.02316.77
7.0.40.0070.03216.82
7.0.30.0200.04016.86
7.0.20.0130.04716.94
7.0.10.0160.04616.88
7.0.00.0080.02316.79
5.6.400.0030.00614.55
5.6.390.0070.00714.14
5.6.380.0060.00614.34
5.6.370.0040.00814.69
5.6.360.0030.01514.49
5.6.350.0060.00614.57
5.6.340.0030.00614.32
5.6.330.0090.00614.46
5.6.320.0040.01114.30
5.6.310.0060.00913.92
5.6.300.0030.01714.04
5.6.290.0070.01014.22
5.6.280.0130.03317.56
5.6.270.0070.00714.21
5.6.260.0080.00414.31
5.6.250.0040.01114.43
5.6.240.0080.00614.20
5.6.230.0140.00014.47
5.6.220.0000.01614.03
5.6.210.0080.03517.38
5.6.200.0030.03116.24
5.6.190.0080.04517.41
5.6.180.2080.02517.34
5.6.170.0100.02417.29
5.6.160.0050.02517.39
5.6.150.0070.02516.29
5.6.140.0020.04916.19
5.6.130.0080.04516.24
5.6.120.0030.03017.63
5.6.110.0110.04317.61
5.6.100.0050.04217.79
5.6.90.0080.04217.62
5.6.80.0050.04117.30
5.6.70.0140.04017.41
5.6.60.0070.00714.42
5.6.50.0070.00714.23
5.6.40.0040.01114.08
5.6.30.0030.00614.27
5.6.20.0030.01013.94
5.6.10.0100.00314.32
5.6.00.0070.00714.46
5.5.380.0000.01414.45
5.5.370.0030.00914.15
5.5.360.0100.00314.16
5.5.350.0120.03717.33
5.5.340.0070.04516.14
5.5.330.0030.02717.28
5.5.320.0180.04117.47
5.5.310.0150.03317.11
5.5.300.0110.02216.13
5.5.290.0050.04316.05
5.5.280.0050.02817.46
5.5.270.0090.02117.47
5.5.260.0100.02817.55
5.5.250.0050.03417.20
5.5.240.0020.04217.24
5.5.230.0110.00314.04
5.5.220.0030.01014.02
5.5.210.0060.00613.93
5.5.200.0100.00313.97
5.5.190.0070.00314.14
5.5.180.0080.00414.18
5.5.170.0070.00714.25
5.5.160.0000.01214.40
5.5.150.0000.01014.36
5.5.140.0130.00314.16
5.5.130.0000.01313.95
5.5.120.0030.01014.04
5.5.110.0040.00814.12
5.5.100.0030.00714.10
5.5.90.0040.01114.27
5.5.80.0060.00914.36
5.5.70.0030.01013.75
5.5.60.0060.00914.00
5.5.50.0000.01613.99
5.5.40.0030.01013.98
5.5.30.0000.01514.34
5.5.20.0040.01114.24
5.5.10.0100.00313.86
5.5.00.0110.00014.13
5.4.450.0350.03216.27
5.4.440.0380.02916.28
5.4.430.0420.03016.26
5.4.420.0070.03016.48
5.4.410.0070.03316.47
5.4.400.0580.03315.99
5.4.390.0520.03215.98
5.4.380.0240.02216.06
5.4.370.0070.03016.04
5.4.360.0100.02616.06
5.4.350.0050.02212.70
5.4.340.0040.02312.70
5.4.330.0040.00813.37
5.4.320.0070.02012.94
5.4.310.0040.02412.94
5.4.300.0030.02212.94
5.4.290.0030.02412.94
5.4.280.0050.02512.89
5.4.270.0040.02512.89
5.4.260.0050.02612.89
5.4.250.0040.03416.07
5.4.240.0050.03016.13
5.4.230.0050.03416.16
5.4.220.0080.03016.19
5.4.210.0090.02716.17
5.4.200.0050.04016.06
5.4.190.0110.02616.17
5.4.180.0100.02816.15
5.4.170.0080.03116.15
5.4.160.0050.03616.10
5.4.150.0070.03016.13
5.4.140.0050.02814.93
5.4.130.0080.03314.83
5.4.120.0050.03114.93
5.4.110.0080.03114.92
5.4.100.0000.03614.94
5.4.90.0090.02515.01
5.4.80.0090.02614.84
5.4.70.0080.02314.88
5.4.60.0030.03114.84
5.4.50.0070.02714.92
5.4.40.0100.02614.90
5.4.30.0090.02314.91
5.4.20.0140.02714.98
5.4.10.0110.02514.99
5.4.00.0070.03214.57
5.3.290.0080.02013.08
5.3.280.0050.02714.03
5.3.270.0050.03013.91
5.3.260.0070.03214.04
5.3.250.0080.02713.99
5.3.240.0110.02614.05
5.3.230.0050.03314.07
5.3.220.0060.03013.97
5.3.210.0080.02813.93
5.3.200.0050.03313.96
5.3.190.0060.02814.02
5.3.180.0050.03114.01
5.3.170.0130.03614.01
5.3.160.0070.03914.02
5.3.150.0100.03613.98
5.3.140.0050.04014.05
5.3.130.0070.03014.05
5.3.120.0050.03014.01
5.3.110.0120.03213.95
5.3.100.0050.02913.75
5.3.90.0120.03513.68
5.3.80.0080.02713.73
5.3.70.0100.03713.74
5.3.60.0080.03113.80
5.3.50.0060.03013.70
5.3.40.0050.03513.71
5.3.30.0030.02713.64
5.3.20.0040.02713.55
5.3.10.0050.02713.54
5.3.00.0050.03213.55
5.2.170.0100.03711.24
5.2.160.0070.04311.23
5.2.150.0030.06311.23
5.2.140.0000.04711.16
5.2.130.0100.03711.20
5.2.120.0100.03711.20
5.2.110.0070.04711.20
5.2.100.0100.05711.21
5.2.90.0130.05311.29
5.2.80.0030.04311.09
5.2.70.0070.04311.17
5.2.60.0130.04011.15
5.2.50.0030.04311.13
5.2.40.0070.05011.20
5.2.30.0200.02710.97
5.2.20.0070.04011.07
5.2.10.0070.04711.04
5.2.00.0070.04010.57
5.1.60.0100.03310.21
5.1.50.0100.03010.02
5.1.40.0070.0339.91
5.1.30.0070.04710.41
5.1.20.0070.03710.43
5.1.10.0100.03010.15
5.1.00.0070.0339.92
5.0.50.0000.0338.57
5.0.40.0070.0338.52
5.0.30.0070.0378.30
5.0.20.0030.0278.31
5.0.10.0030.0408.44
5.0.00.0030.0408.14
4.4.90.0030.0307.35
4.4.80.0030.0207.35
4.4.70.0000.0337.35
4.4.60.0030.0307.35
4.4.50.0100.0207.35
4.4.40.0000.0377.32
4.4.30.0070.0207.32
4.4.20.0030.0207.32
4.4.10.0070.0177.32
4.4.00.0030.0337.32
4.3.110.0130.0237.32
4.3.100.0070.0177.32
4.3.90.0000.0207.32
4.3.80.0000.0337.32
4.3.70.0000.0307.32
4.3.60.0030.0207.32
4.3.50.0000.0277.32
4.3.40.0000.0377.32
4.3.30.0000.0237.32
4.3.20.0030.0207.32
4.3.10.0070.0177.32
4.3.00.0130.0206.66

preferences:
65.84 ms | 401 KiB | 5 Q