You can use the PHP function error_reporting() at run time to set the level of error reporting in your application.

The different levels of reporting are based on bit masks or using a CONSTANT name. They are:

1       E_ERROR
2       E_WARNING
4       E_PARSE
8       E_NOTICE
16      E_CORE_ERROR
32      E_CORE_WARNING
64      E_COMPILE_ERROR
128     E_COMPILE_WARNING
256     E_USER_ERROR
512     E_USER_WARNING
1024    E_USER_NOTICE
2048    E_STRICT
4096    E_RECOVERABLE_ERROR
8192    E_DEPRECATED
16384   E_USER_DEPRECATED
32767   E_ALL

If you want to hide all errors : use zero:

error_reporting(0);

Otherwise, you can just use the bitmask or the name:

//show RECOVERABLE
error_reporting(4096);

//SHOW RECOVERABLE AND USER ERROR
error_reporting(4096 + 256);

//show warnings and deprecated
error_reporting(E_WARNING | E_DEPRECATED);

//show all except Notices
error_reporting(E_ALL ^ E_NOTICE);

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.