Re: Bitwise NOT operator?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20 August 2010 17:00, Andy McKenzie <amckenzie4@xxxxxxxxx> wrote:
>  Thanks to everyone who responded.  I've dealt with binary math
> before, but it never occurred to me (and doesn't seem to be anywhere
> in the document page at php.net!) that it would automatically pad the
> number I entered.

There is no padding.

php -r "echo decbin(~2), PHP_EOL, decbin(-3);"
11111111111111111111111111111101
11111111111111111111111111111101

That's 100% correct and proper. Not "padded".

The example in [1] regarding E_ALL & ~E_NOTICE is a perfect example.

Richard.

[1] http://docs.php.net/manual/en/language.operators.bitwise.php
-- 
Richard Quadling.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux