note 85156 added to language.operators.bitwise
| From: | darkelder@php.net | Date: | Mon, 18 Aug 2008 10:49:41 +0000 |
| Subject: | note 85156 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143581@lists.php.net to get a copy of this message | ||
Here is a usefull class to work with flags:
class flags {
function has_flag($flags, $flag_check) {
if (($flags & $flag_check) == $flag_check) {
return true;
}
return false;
}
function add_flag($flags, $flag_check) {
// already have the flag, so return it as it is
if ($this->has_flag($flags, $flag_check)) {
return $flags;
}
return $flags ^ $flag_check;
}
function del_flag($flags, $flag_check) {
// already have not the flag, so return it as it is
if (!$this->has_flag($flags, $flag_check)) {
return $flags;
}
return $flags ^ $flag_check;
}
}
----
Server IP: 200.185.109.13
Probable Submitter: 200.180.176.110
----
Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php
Edit -- https://master.php.net/note/edit/85156
Del: integrated -- https://master.php.net/note/delete/85156/integrated
Del: useless -- https://master.php.net/note/delete/85156/useless
Del: bad code -- https://master.php.net/note/delete/85156/bad+code
Del: spam -- https://master.php.net/note/delete/85156/spam
Del: non-english -- https://master.php.net/note/delete/85156/non-english
Del: in docs -- https://master.php.net/note/delete/85156/in+docs
Del: other reasons-- https://master.php.net/note/delete/85156
Reject -- https://master.php.net/note/reject/85156
Search -- https://master.php.net/manage/user-notes.php