note 78598 deleted from reserved.constants by danbrown

From: Date: Sat, 13 Jun 2009 01:37:40 +0000
Subject: note 78598 deleted from reserved.constants by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156834@lists.php.net to get a copy of this message
Note Submitter: josharian at gmail dot com ---- @docey: Unfortunately, that will not work -- PHP will convert (PHP_INT_MAX+1) to a float. At least on my system, the minimum integer size is -PHP_INT_MAX - 1. I would say that that should be reliable elsewhere, but PHP ints have known portability issues -- see e.g. http://preview.tinyurl.com/ywh7ya Confirm this way: <?php echo gettype(PHP_INT_MAX) . "\n"; echo gettype(PHP_INT_MAX + 1) . "\n"; echo gettype(-PHP_INT_MAX) . "\n"; echo gettype(-PHP_INT_MAX - 1) . "\n"; echo gettype(-PHP_INT_MAX - 2) . "\n"; ?> On my system this yields: integer double integer integer double It would be nice to have a PHP_INT_MIN, though. Even better would be to have reliable, predictable data types...

« previous php.notes (#156834) next »