Re: Different binary results with different PHP versions
- From: David Haynes <david.haynes2@xxxxxxxxxxxx>
- Date: Wed, 31 May 2006 06:36:56 -0400
Skeleton wrote:
Yes, I have read the manual and notes below the manual. But actually, I
don't need exactly the decbin function. I have used that just to show
something going wrong. My point is the ^ operator. For ex, look at the
following code and its outputs:
echo (1 ^ -5817441119);
// Prints -1522473824 which is true result, at PHP 5.1.2 + Windows
// Prints -2147483647 which is false result, at PHP 4.4.2 + Linux
I also thought that the reason is that the number is too small, but why
PHP 5 calculates correctly? Is there a big difference in number types
between PHP 4 and PHP 5? I don't know if it helps but when I checked
PHP_INT_MAX, it is 2147483647 for both.
Be careful of your base assumptions. php 5.1.2 on Linux produces -2147483647 as well.
-david-
.
- Follow-Ups:
- Re: Different binary results with different PHP versions
- From: Skeleton
- Re: Different binary results with different PHP versions
- References:
- Different binary results with different PHP versions
- From: Skeleton
- Re: Different binary results with different PHP versions
- From: Erwin Moller
- Re: Different binary results with different PHP versions
- From: Skeleton
- Different binary results with different PHP versions
- Prev by Date: Re: while loops?
- Next by Date: Re: Different binary results with different PHP versions
- Previous by thread: Re: Different binary results with different PHP versions
- Next by thread: Re: Different binary results with different PHP versions
- Index(es):
Relevant Pages
|