Re: Different Values for intval(float)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>   .   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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux