@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...
