Page 1 of 1

php adding e+14 to argument

Posted: Wed Jun 30, 2010 9:42 pm
by mlecho
hi all...i have to pass a big number like 131230510244007 to a method, but in the method it is being read like 1.31230510244E+14. It's really a straight forward thing, but i am not sure why php sees the number as such. What can i do to straighten this up?

here is the gist:

Code: Select all

public function getPhotos($album)
	{     
		$data= $this->_query(GETPHOTOS,array("album"=>131230510244007)); 
		return $data;
	}
public function _query($q,$args=null)
{
    $album = $args['album'];
    echo $album;
    return $this->doSomethingWithAlbum($album);
}

Re: php adding e+14 to argument

Posted: Wed Jun 30, 2010 10:54 pm
by requinix
Most regular computers can't handle numbers that large. You just can't.

Pass it as a string, and if you need to do calculations on it use something like bcmath.