Jump to content

[SOLVED] Scientific Notation to Regular Integer


xProteuSx

Recommended Posts

Ok, here we go again!  I have been trying to solve this for a while:

 

I have a DB with a column full of numbers.  Some of these numbers are very big and, when they are stored in the DB they are stored in the scientific notation format, such as 1000000=1e+06.  I would like to take these numbers from a DB, and show them as integers.  Right now if I do this:

 

echo $numberfromdb;  my output is '1e+06'

 

If I try the following:

 

$numberfromdb = 1e+06;

$formattednumber = (int) $numberfromdb;

echo $formattednumber; my output is '1'

 

My quick solution was to change the DB column from 'float' type to 'bigint' type.  However, I just realized that I have made a big boo-boo.  I have several numbers which are fractions in decimal form (such as .50 and .25) and they have all been replaced with the number 1.  Should be fun going back through 2300+ entries to fix this.  Anyways, I am back to square one.

 

How do I get 1e+06 to echo as 1000000???  Please help!  This is very important and semi urgent.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.