note 9998 added to Error Handling
| From: | mgile at luminee dot com | Date: | Tue, 05 Dec 2000 21:48:58 +0000 |
| Subject: | note 9998 added to Error Handling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8434@lists.php.net to get a copy of this message | ||
Here are some good ways to use error checking (Java like)
// stop reporting errors
function catch() {
global $oldErrorLevel;
$oldErrorLevel = error_reporting(E_PARSE & E_COMPILE_ERROR & E_COMPILE_WARNING);
}
// start reporting errors
function release() {
global $oldErrorLevel, $php_errormsg;
error_reporting($oldErrorLevel);
return $php_errormsg;
}
// $v is not an object
$v = 1;
catch();
// dangerous code
$v->get();
$msg = release();
http://www.php.net/manual/features.error-handling.php