note 45454 deleted from language.operators.bitwise by danielc

From: Date: Mon, 13 Apr 2009 16:12:32 +0000
Subject: note 45454 deleted from language.operators.bitwise by danielc
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153161@lists.php.net to get a copy of this message
Note Submitter: Gemini_5 Reason: 0 ---- Extending the comment by andrew at thepenry dot net: His (slightly altered) function for reference: <?php function setflag(&$var, $flag, $set) { if (($set == 1)) $var = ($var | $flag); if (($set == 0)) $var = ($var & ~$flag); return; } ?> You could shorten the operations to: <?php $var |= $flag; // for setting $var &= ~$flag; // for unsetting ?> Which kind of eliminates the need for a function.

« previous php.notes (#153161) next »