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!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
In java the following code generates the following output. But when i converted this code to PHP, the output was not same. Even i tried with 64 bit bitwise operation. Anybody can convert this snippet to PHP so that the same result come?
[syntax="java"]long a = 0;
long c = -589949350;
for(int j=0;j<4;j++)
{
a=(a^c&0xff)*0x9e3779b1;
c=c>>8;
println(a);
println(c);
}
Loop 1:
-------
a = -147647838150
c = -2304490
Loop 2:
-------
a = 2413261624394330732
c = -9002
Loop 3:
-------
a = 4360021387243289754
c = -36
Loop 4:
-------
a = -5030538659600629146
c = -1
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Looks like $c is always right. Not sure where $a is going wrong.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
(As java Long is 64 bits...) How can you achieve 64bits bitwise operation with php on a 32bits system? I can't find it in the manual under http://be.php.net/language.operators.bitwise