You are here: Re: Difference of & in perl and php « PHP Programming Language « IT news, forums, messages
Re: Difference of & in perl and php

Posted by d on 11/18/79 11:41

<fritz-bayer@web.de> wrote in message
news:1141404106.485472.53880@z34g2000cwc.googlegroups.com...
> Hello,
>
> I'm porting a program from php to perl and discovered, that the bitwise
> operator & seems to work differently, which I don't understand why.
>
> I tested it with the values:
>
> a=5543039447 and b=13
>
> Then in perl the expressions:
>
> $result= ($z & $a);
>
> returns 2147483648.
>
> But in php the same expression returns zero. Why is that and how can I
> fix it?!

If you have defined $a and $b, then bitwise-anded $z and $a, you *should*
get zero, as zero AND anything is zero. If, however, you do bitwise-and $a
and $b, you shouldn't get 2147483648 in the first place, so I don't know
where your problem is :)

> Fritz
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация