pooja
pooja

Reputation: 2422

How do we convert exponent format into actual number from PHP

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

Upvotes: 3

Views: 1948

Answers (2)

JohnP
JohnP

Reputation: 50019

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

Upvotes: 1

BoltClock
BoltClock

Reputation: 723729

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.

Upvotes: 1

Related Questions