How do we convert exponent format into actual number from PHP

后端 未结 2 1121
误落风尘
误落风尘 2021-01-20 08:28

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

相关标签:
2条回答
  • 2021-01-20 09:04

    Cast to a float if not already a float, and printf() the result:

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

    Note that casting to int won't work because that cast does not understand numbers expressed as strings in scientific notation. And on some systems, your given number is too large to fit into an int so PHP may make it a float instead.

    0 讨论(0)
  • 2021-01-20 09:25

    It's already an actual value. The value type is float.

    $float = 8.64E+14;
    var_dump($float); //will give you float 8.64E+14
    
    0 讨论(0)
提交回复
热议问题