Re: & behaves differently
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: & behaves differently

From: d <d@example.com>
Date: Fri Mar 03 2006 - 18:42:40 CET

<fritz-bayer@web.de> wrote in message
news:1141407160.003705.72180@i40g2000cwc.googlegroups.com...
> Hi,
>
> why does the php expression
>
> $result = 5543039447 & 2147483648;
>
> when executed evaluate to 0, whereas the perl expression
>
> $same = 5543039447 & 2147483648 ;
>
> evaluate to 2147483648 ???

Because perl is screwed?

5543039447 = 101001010011001000001000111010111

and

2147483648 = 010000000000000000000000000000000

As you can see, if you and both of those, you get zero. It seems PHP is
right on this one.

> Fritz
>

dave
Received on Mon May 1 02:26:41 2006