Aha :) Thanks. > -----Original Message----- > From: Jasper Bryant-Greene [mailto:jasper@xxxxxxxxxxx] > Sent: 21 October 2005 22:04 > To: savage@xxxxxxxxxxxxx > Cc: php-general@xxxxxxxxxxxxx > Subject: Re: Declaring vars as INT ? > > On Fri, 2005-10-21 at 21:39 +0200, 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) > > It's not a PHP bug. I'm guessing you're on a 32-bit platform. > 2147483647 is the maximum length of a signed integer on a > 32-bit platform, and PHP doesn't do unsigned integers. > > A date in the form of yyyymmddsss etc. isn't really a number, > so if it was me I'd probably treat it as a string. If you > really *have* to treat it as a number, then use float and get > all the precision errors that come with floating-point, or > use binary coded decimal or another arbitrary precision system. > > -- > Jasper Bryant-Greene > General Manager > Album Limited > > e: jasper@xxxxxxxxxxx > w: http://www.album.co.nz/ > p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 > a: PO Box 579, Christchurch 8015, New Zealand > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php