Doc #65457 [Opn->Nab]: Example on Bitwise Operators page: XOR is not same as AND NOT

From: Date: Mon, 19 Aug 2013 05:21:31 +0000
Subject: Doc #65457 [Opn->Nab]: Example on Bitwise Operators page: XOR is not same as AND NOT
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10178@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65457&edit=1 ID: 65457 Updated by: krakjoe@php.net Reported by: david at beroff dot com Summary: Example on Bitwise Operators page: XOR is not same as AND NOT -Status: Open +Status: Not a bug Type: Documentation Problem Package: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: It is not the job of the PHP manual to educate the reader on bitwise comparisons, it is the job of the manual to educate the reader on bitwise comparisons _in PHP_. There is no good reason to remove the example, why it works is explained well. Previous Comments: ------------------------------------------------------------------------ [2013-08-16 05:51:24] david at beroff dot com Description: ------------ On http://php.net/manual/en/language.operators.bitwise.php , there is an example which states, "Another way to accomplish... [E_ALL & ~E_NOTICE] ...is [by] using XOR...". While this yields the same result in THIS particular example, (because all of the relevant bits of E_ALL are set), it could have the undesired effect of incorrectly leading people to assume that this shortcut can/should be used in all cases. In a case where the first value had a cleared bit in the desired location, use of XOR would actually turn it on, rather than having the intended effect of turning it off. There is actually a comment (#98979) left by steffen at NO-SPAM dot haugk dot co dot uk to the same effect, but apparently no action had been taken in the three years since it was written. I respectfully ask you to please simply remove the example. Thank you. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65457&edit=1

« previous php.doc.bugs (#10178) next »