|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-11-26 02:37 UTC] derick@php.net
[2001-11-26 14:35 UTC] at217 at chebucto dot ns dot ca
[2001-11-26 14:42 UTC] derick@php.net
[2001-12-12 15:47 UTC] derick@php.net
[2003-04-25 11:25 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 12:00:01 2025 UTC |
When assigning the value -2147483648 to a variable, the variable becomes a double, even though the value is within the range of integers. In fact, assigning -2147483647 - 1 works, as does using intval("-2147483648"). The following script demonstrates, and can be accessed at <http://www.randomsample.org/tests/test-int-min.php>. <?php $int_max = 2147483647; $int_min = -2147483648; $int_min_alt = -2147483647 - 1; ?> <html><head><title>Test INT_MIN</title></head> <body> <p>Type of "2147483647": <?php echo gettype( $int_max ); ?> (value = <?php echo $int_max; ?>)</p> <p>Type of "-2147483648": <?php echo gettype( $int_min ); ?> (value = <?php echo $int_min; ?>)</p> <p>Type of "-2147483647 - 1": <?php echo gettype( $int_min_alt ); ?> (value = <?php echo $int_min_alt; ?>)</p> </body> </html> This is an ISP-provided build, but the configure line from phpinfo() is: './configure' '--with-config-file-path=/etc' '--enable-safe-mode=yes' '--enable-force-cgi-redirect=yes' '--with-gdbm' '--with-mysql' '--with-exec-dir=/www/cgi-bin' '--bindir=/www/cgi-bin' '--enable-ftp' '--enable-trans-sid' '--with-gd=/usr' '--with-zlib=/usr' '--with-jpeg-dir=/usr' '--enable-gd-native-ttf' '--with-png-dir=/usr' '--with-ttf=/usr/lib'