note 52032 added to language.operators.bitwise
| From: | S�b dot at osu1 dot php dot net | Date: | Tue, 19 Apr 2005 14:28:21 +0000 |
| Subject: | note 52032 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88213@lists.php.net to get a copy of this message | ||
Another practical case...
<?php
header('Content-Type: text/plain') ;
// We want to know the power-2 based numbers of $x
$x = 9124 ;
$n = 1 ;
while ( $x > 0 ) {
if ( $x & 1 == 1 ) {
echo $n, "\n" ;
}
$n *= 2 ;
$x >>= 1 ;
}
// Will output...
// 4
// 32
// 128
// 256
// 512
// 8192
?>
----
Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52032
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52032&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52032&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52032&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52032&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52032&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52032&report=yes
Search -- http://master.php.net/manage/user-notes.php