Try this:
<?
$a=-2000000000e0;
$b=$a4;
$c=$a1;
echo -11474836489*1;
echo "<br>".$b;
echo "<br>".$c;
?>
Prints out:
-11474836489
-8000000000
-2000000000
Remember, all numerical values are treated as int, so if you have a digit > (231 - 1) or < -(231), then suffix it with e0 which will automatically make the literal a floating-point value.
BTW: When I do:
if(-1147483648e0>1000000000)
I get false. So I guess floating points have to be suffixed with a decimal or in scientific notation. I agree with you: It IS strange when you do just: -1147483648>1000000000 and it is true :-)
I think this is dumb. PHP should be like JavaScript and automatically decide data types for numerical values. The only thing I DONT like about JavaScript is that it treats ALL numerical values as floating points, which if done in PHP, memory allocation might be something to worry about. So I don't mind the way it is now in PHP, but I think in the future it should be modified so that if you DO declare a literal greater than the length allowed by the data-type, it should declare the variable with the next larger data type.
Does anyone else agree with me on this?
hope this helps,
-sridhar