Search code examples
phperror-reporting

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


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.


Solution

  • 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)