| 
	
 | 
 Posted by d on 06/12/05 11:41 
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message  
news:P4qdnZ1ghuZKFJXZRVn-qw@comcast.com... 
> 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. 
 
PHP interprets ints over 32 bits as floats, so they are valid. 
 
"If you specify a number beyond the bounds of the integer type, it will be  
interpreted as a float instead. Also, if you perform an operation that  
results in a number beyond the bounds of the integer type, a float will be  
returned instead." 
 
> --  
> ================== 
> Remove the "x" from my email address 
> Jerry Stuckle 
> JDS Computer Training Corp. 
> jstucklex@attglobal.net 
> ==================
 
  
Navigation:
[Reply to this message] 
 |