tarnfeld
tarnfeld

Reputation: 26556

PHP Convert to int

Im not sure what this type of number is '1.3122278540256E+18' but how can i expand it into an integer?

Thanks!!

Upvotes: 0

Views: 610

Answers (3)

Byron Whitlock
Byron Whitlock

Reputation: 53861

It is in IEEE floating point notation. It is a number too large to be calcuated exactly, but move the decimal +18 places to the right to get the integer.

Upvotes: 2

Dan Loewenherz
Dan Loewenherz

Reputation: 11236

This is scientific notation.

E+18 is shorthand for 10^18. In this case, the number you see is 1,312,227,854,025,600,000.

Upvotes: 1

Amber
Amber

Reputation: 526613

That's a floating-point number expressed in scientific notation (the "E+18" means "times 10 to the 18th power"). Chances are it's being displayed that way due to its length; you might try using printf to format it as a standard integer.

Upvotes: 4

Related Questions