Re: Re: Bad PHP error

From: Date: Sat, 27 Nov 2004 22:39:01 +0000
Subject: Re: Re: Bad PHP error
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-202978@lists.php.net to get a copy of this message
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.

« previous php.general (#202978) next »