1

In https://stackoverflow.com/a/2867082/288568 I found two ways of disabling notices. So what exactly is the a difference between

error_reporting(E_ALL ^ E_NOTICE);

and

error_reporting(E_ALL & ~E_NOTICE);

?

And what does the following line do?

error_reporting((E_ALL | E_STRICT) ^ E_DEPRECATED  ^ E_NOTICE );

Would this correctly report E_ALL and E_STRICT but not DEPRECATED AND NOTICEs ?

Community
  • 1
  • 1
Alex
  • 32,506
  • 16
  • 106
  • 171

1 Answers1

1
var_dump(error_reporting(E_ALL ^ E_NOTICE));
var_dump(error_reporting(E_ALL & ~E_NOTICE));

is the same int(32759). Just different binary operations to get there.

Would this correctly report E_ALL and E_STRICT but not DEPRECATED AND NOTICEs ?

var_dump( decbin ((E_ALL | E_STRICT) ^ E_DEPRECATED  ^ E_NOTICE) );

is

101111111110111

111111111111111 E_ALL
000100000000000 E_STRICT
000000000001000 E_NOTICE
010000000000000 E_DEPRECATED

So the anwser is yes and (E_ALL ^ E_DEPRECATED ^ E_NOTICE) would be the same.

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180