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: Jerry Stuckle <jstucklex@attglobal.net>
Date: Fri Mar 03 2006 - 19:22:22 CET

fritz-bayer@web.de wrote:
> Hi,
>
> why does the php expression
>
> $result = 5543039447 & 2147483648;
>
> when executed evaluate to 0, whereas the perl expression
>
> $same = 5543039447 & 2147483648 ;
>
> evaluate to 2147483648 ???
>
> Fritz
>

Because Perl is using 64 bit integers and PHP is using 32 bit integers.

2147483648 is not a valid value in 32 bit arithmetic. The largest value
you can have is 2147483647.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Received on Mon May 1 02:26:48 2006