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.
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)
E_ALL would should all the error and warning and notice - everything
E_NOTICE is a special error level, showing things that won't produce error but are not good or gonna be obsolete in future release of PHP. The notice error level is meant to encourage best practices.
Also it should be error_reporting(E_ALL ^ E_NOTICE);
to report everything except notice.
You are advice during development to set the error reporting to E_ALL and fix all the notice errors.
a look in the manual would give much more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With