How to convert exponent format to actual number from PHP

How do we convert 8.64E+14to actual value from PHP?

+3
source share
2 answers

Paste in float, if not float yet, and printf()result:

printf('%.0f', (float) '8.64E+14');

Note that dropping in int will not work, because it does not understand numbers expressed as strings in scientific notation. And on some systems, your given number is too large to fit in an int, so PHP can make it float.

+1
source

This is the actual value. The type of the value is float.

$float = 8.64E+14;
var_dump($float); //will give you float 8.64E+14
+1
source

All Articles