Page 1 of 1

Issue using Bitwise Operator - Mgration from PHP4 to PHP5

Posted: Tue Nov 17, 2009 11:21 pm
by urnetmate
Hello all,

I am getting the errors in the script used to perform the Bitwise operations. The same script works fine on PHP4, but gives different results in PHP5.
Here is a sample code, which gives different results on PHP4 and PHP5.

Code: Select all

 
<?php
$a = 4653896912;
$b = 12;
$a = ($a >> $b);
echo $a;
?>
 
Please suggest me the solution.
Thanks.

Re: Issue using Bitwise Operator - Mgration from PHP4 to PHP5

Posted: Wed Nov 18, 2009 1:29 am
by urnetmate
My findings:
The difference in the output of the same script is because PHP4 works on 32bit stream and PHP5 works on 64bits stream.

Thus to make the script evaluate to the expected results, I updated the entire logic (algorithm) of the script.
-Thanks