Issue using Bitwise Operator - Mgration from PHP4 to PHP5

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
urnetmate
Forum Commoner
Posts: 27
Joined: Wed Sep 27, 2006 1:09 am

Issue using Bitwise Operator - Mgration from PHP4 to PHP5

Post 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.
urnetmate
Forum Commoner
Posts: 27
Joined: Wed Sep 27, 2006 1:09 am

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

Post 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
Post Reply