On Fri, October 21, 2005 2:39 pm, Chris Knipe wrote: > Function DoSomething($Blah) { > $Blah = (int) $Blah; > return $Blah > } > > $Blah, cannot be larger than 2147483647, and sometimes, I get negative > integers back from the above function. > > This is with PHP 4.4.0 on FreeBSD 5.4-STABLE. Can anyone else perhaps > confirm this, and if it is indeed true, is this a bug, or a limitation > somewhere on PHP? Any other ways to confirm that *large* numbers, are > indeed integers? I'm working with numbers in the form of yyyymmddsss > (20051025001 for today for example) PHP integers are limited by 32-bit hardware and a simplicity of design to -2147483648 to 2147483647. There are no unsigned, long, double long, or google ungle longles. [I made that last one up, but it sure sounds good, don't it?] Your options are, however, several. 1. Use BCMATH or that fancy new-fangled big-number package to deal with numbers as big as you want, subject only to the amount of RAM in your box and the number of values you want to use at one time. Performance will not be integer-fast as these packages use string-manipulation to compute mathematical values, but they can get VERY big numbers, with whatever precision you specify. 2. In this particular instance, it's a *DATE* so you should consider converting it to a Unix time-stamp. This does limit you to 1/1/1970 midnight to somewhere in March 2038, however, as that is the same 32-bit limited range in number of seconds between 1/1/1970 midnight and 2 * 2147483647 seconds later than that. Note that this is strictly hardware-based, so if you get a 64-bit machine, your date range goes until, like, 1970 + 2 * (2038 - 1970) If your dates range beyond 1/1/1970 and/or 2038, you may want to simply NOT convert them to integer in the first place. Also note that database software can generally provide more options for date storage, date arithmetic and date-handling in general. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php