i am sharing here a common function to set error reporting based on the mode :null , min , max , dev , custom
function set_error_reporting($type=0,$custom=''){
switch ($type)
{
default:
case 'none':
case 'null':
case '0'://no error reporting . its default
error_reporting(0);
break;
case '1':
case 'min'://minimum error reporting with error , warning and parse error will be shown
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('display_errors', 1);
break;
case '2':
case 'max'://maximum error reporting:all error will be reported
error_reporting(E_ALL);
ini_set('display_errors', 1);
break;
case '3':
case 'dev'://devlopment mode
error_reporting(-1);
ini_set('display_errors', 1);
break;
case '4':
case 'custom'://custom mode
error_reporting($custom);
break;
}
}
Null mode : set_error_reporting(0); or set_error_reporting("null") or set_error_reporting("none") or set_error_reporting(); will disable error reporting .
Min mode : set_error_reporting("min"); will show only Error , Warning and Parse Error. alternative initialization set_error_reporting(1);
Max mode : set_error_reporting("max"); will show all errors , alternative initialization set_error_reporting(2);
Dev Mode : set_error_reporting("dev"); same as max show you all error , alternative initialization set_error_reporting(3);
Custom Mode : set_error_reporting("custom",E_STRICT); in this case you can pass second argument what type error reporting you need , alternative initialization set_error_reporting(4);
hope it help