Re: Different Values for intval(float)

From: Date: Sat, 18 Feb 2006 15:56:33 +0000
Subject: Re: Different Values for intval(float)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230690@lists.php.net to get a copy of this message
Bruce wrote:
Consider the following code: $BB = -2181087916; $AA = (int)$BB; $AA = intval($BB); On some systems, $AA will be int(-2147483648), which is actually consistent with the documentation. On most systems, however, $AA will be int(2113879380), which is the same value truncated at 32 bits. Interestingly enough, I tried it on several of my machines, which are different platforms and different (sub)versions of PHP and I got different results:
   RH7.3 with PHP 4.1.2:         2113879380
IRIX 6.5.11 with PHP 4.2.3: 2147483647
   FC1 with PHP 4.3.6:           2113879380
   RH7.3 with PHP 4.3.9:         2113879380
   FC3 with PHP 4.3.10:         -2147483648
   FC4 with PHP 4.4.0:          -2147483648
   FC4 with PHP 5.0.5:          -2147483648
So my question now, is it version or platform related? -- H | I haven't lost my mind; it's backed up on tape somewhere. +-------------------------------------------------------------------- Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Imaging . 3550 Arapahoe Ave. #6 http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.

« previous php.general (#230690) next »