Re: Different binary results with different PHP versions
- From: "Chung Leong" <chernyshevsky@xxxxxxxxxxx>
- Date: 31 May 2006 11:13:31 -0700
Skeleton wrote:
So what should I do at this point? I need to make XOR operations with
such big(small) numbers.
Chung Leong wrote:
Skeleton wrote:
My PHP 5.1.2 is on Windows. So the problem is about the Operating
Systems.
David Haynes wrote:
Be careful of your base assumptions. php 5.1.2 on Linux produces
-2147483647 as well.
-david-
No, it's difference is in the compiler. The operation you describe
causes a double-to-long-integer conversion overflow. Gcc probably
throws in a check which sets the value to the integer boundary whereas
MS Visual C just lets it wrap around.
What exactly are you trying to do? One possible solution is to perform
the operation on strings instead:
<?
$a = "\x01\x02\x03";
$b = "\xFF\x02\x03";
$c = $a ^ $b;
for($i = 0; $i < strlen($c); $i++) {
printf("%x, ", ord($c[$i]));
}
?>
.
- 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
- Re: Different binary results with different PHP versions
- From: David Haynes
- Re: Different binary results with different PHP versions
- From: Skeleton
- Re: Different binary results with different PHP versions
- From: Chung Leong
- Re: Different binary results with different PHP versions
- From: Skeleton
- Different binary results with different PHP versions
- Prev by Date: Re: Handling exception question
- Next by Date: HELP!! PHP Warning: PHP Startup: Unable to load dynamic library 'c:\PHP\Ext\php_mysql.dll' - The specified procedure could not be found. in Unknown on line 0
- Previous by thread: Re: Different binary results with different PHP versions
- Next by thread: <<< State of the art web solution Online>>>
- Index(es):
Relevant Pages
|