note 47386 deleted from function.error-reporting by bjori
| From: | bjori@php.net | Date: | Mon, 24 Apr 2006 15:29:58 +0000 |
| Subject: | note 47386 deleted from function.error-reporting by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109461@lists.php.net to get a copy of this message | ||
Note Submitter: dnirvine[at]gmail[dot]com
----
<?php
# config.ini
# PHP error reporting. supported values are given below.
# 0 - Turn off all error reporting
# 1 - Running errors
# 2 - Running errors + notices
# 3 - All errors except notices and warnings
# 4 - All errors except notices
# 5 - All errors
php_error_reporting=4
# config.ini ends
Setting error_reporting in PHP files would be something like the code below, assuming the function
getinivar() returns the variable value from the configuration file.
[code]
// setting PHP error reporting
switch(getinivar('php_error_reporting')) {
case 0: error_reporting(0); break;
case 1: error_reporting(E_ERROR | E_WARNING | E_PARSE); break;
case 2: error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); break;
case 3: error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); break;
case 4: error_reporting(E_ALL ^ E_NOTICE); break;
case 5: error_reporting(E_ALL); break;
default:
error_reporting(E_ALL);
}
[/code]
?>
I'll have to start using this from now on! Be much easier than having error_reporting(0) and
trying to switch to find errors. Thanks.