dev.learn
dev.learn

Reputation: 177

csv export numbers not displaying correct

Hi I am exporting data to a .csv file. When I open the csv file my one column displays the data like this: 8.944E+19 when I double click on the text to see all the numbers I get this 89440000000014300000 but thats not correct this is the number in the database 89440000000014384616. Any help would be appreciated.

Upvotes: 0

Views: 321

Answers (1)

Repox
Repox

Reputation: 15476

This is an issue caused by the large numbers you are trying to use.

PHP uses floats, or signed 32-bit ints to store numbers. Clearly this is not enough. You can use arbitrary precision arithmetic to store these large numbers. See the PHP book on BC Math for more information:

http://php.net/manual/en/book.bc.php

Upvotes: 1

Related Questions