What are differences between error_reporting(E_ALL) and error_reporting(E_ALL & ~E_NOTICE)

shin picture shin · Nov 5, 2009 · Viewed 19.4k times · Source

Could anyone explain differences between error_reporting(E_ALL); and error_reporting(E_ALL & ~E_NOTICE); ?

I noticed that when I change from E_ALL to E_ALL & ~E_NOTICE, an error which I was hacking, disappears.

Answer

timdev picture timdev · Nov 5, 2009

E_ALL is "everything"

E_ALL & ~E_NOTICE is "everything except notices"

Notices are the least-urgent kinds of messages. But they can be very useful for catching stupid programmer mistakes, like trying to read from a hash with a non-existent key, etc.

(To understand the syntax, read up on bitwise operators)