Re: Re: Bad PHP error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Octavian Rasnita wrote:
Well, that big number is not converted as a string and printed this way, or
I am missing something.

Here is an example:

<?php
$var = 1000000000000;
//Here I have also tried inserting $var = (string) $var;
echo "$var";
?>

This prints:

1E+012

and... not 1000000000000 as it should.

I have first tried just echo $var, but I thought that maybe if I put it
between quotes, it will be printed right, but...


If you do:

$var = '1000000000000';
echo $var;

it will print fine, but you can't do any math operations on it or it will get converted to float again.

You can use BCMath functions, if available.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux