2

these two statements:

    $old = errorreport(E_ALL ^ E_NOTICE ^ E_STRICT);
    $old = errorreport(E_ALL & ~E_NOTICE & ~E_STRICT); 

Seem to do the same thing. What is the meaning of "^", "~" ? I cant find a reference for these symbols.

Doug Cassidy
  • 1,602
  • 3
  • 16
  • 26
  • I believe this question should be re-opened, it takes more than the information on the linked question to understand how bit operators relate to E_ALL and E_NOTICE constants. I believe a proper answer should include why and how bit operators effect error reporting behavior in php. – Scott Jan 21 '16 at 20:55
  • i would say the first link on the dupe to http://www.php.net/manual/en/language.operators.bitwise.php covers it –  Jan 21 '16 at 20:58
  • @Dagon - Fair enough, I did not see that link when I first visited the question. That link answers the question perfectly. – Scott Jan 21 '16 at 21:00

2 Answers2

2

~ means "except" DOCS

In your second example that would mean E_ALL except E_NOTICE and E_STRICT

The ^ is a "flipper":

^ is the xor (bit flipping) operator and would actually turn notices on if they were previously off (in the error level on its left).

Jay Blanchard
  • 33,530
  • 16
  • 73
  • 113
  • Ok, so in #2, we are saying e_all, which turns on notice and strict, but then, we are flipping those two, to turn them off. (?) I wonder if the two examples are functionally identical? – Doug Cassidy Jan 21 '16 at 21:02
  • It would seem to me, sans any testing, they are functionally identical. – Jay Blanchard Jan 21 '16 at 21:57
1

Those are bitwise operators. At this page you could have some examples of using them to make error reporting settings.

Anton Serdyuk
  • 1,138
  • 9
  • 13