Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert exponential to a whole number in PHP [duplicate]

Possible Duplicate:
Convert exponential number to decimal in php

Is there a way to convert an exponential number to a whole number in PHP using built in functions? A format function?

1.2378147769392E+14 to 123781477693917

like image 907
DLS Avatar asked Feb 10 '11 23:02

DLS


People also ask

How to define float in PHP?

PHP FloatsA float is a number with a decimal point or a number in exponential form. 2.0, 256.4, 10.358, 7.64E+5, 5.56E-5 are all floats. The float data type can commonly store a value up to 1.7976931348623E+308 (platform dependent), and have a maximum precision of 14 digits.

How to convert string to integer in PHP?

The string number can also be converted into an integer or float by adding 0 with the string. In PHP, performing mathematical operations, the string is converted to an integer or float implicitly. echo $num + 0.1; ?>


1 Answers

number_format(1.2378147769392E+14,0,'','')

However, for working with large numbers, if you want to keep precision, you should look into BCMath extension

like image 117
Mchl Avatar answered Oct 04 '22 17:10

Mchl