<?php
include('oo.ErrorHandler.inc');
$error =& new ErrorHandler();
?>
<?php
echo $a # here you can see the effect of the new PHP scope detection in SOURCE REPORT
?>
<?php
class bugs
{
       function bugs($var)
       {
               $this->_var = $var;
       }

       function warning()
       {
               printf('%d');
       }

       function notice()
       {
               if ($this->_not_set)
                       print '$this->_not_set is TRUE.<br>';
               else
                       return FALSE;
       }

       function error()
       {
               trigger_error('simple example welcomes here for errors.',
                       E_USER_ERROR);
       }
}
/*
$error->report_layout('LOGGING', MULTI_LOG,
       array(FILE_LOG => 'error.log', MAIL_LOG => 'gerzson@localhost'));
*/
$error->report_layout('REPORT', 0, 'SOURCE'); # no source report
$error->report_layout('CONTEXT', 'nostrict', 1); # full context report
$a = new bugs('this variable is set');
$a->notice();
$error->report_layout('CONTEXT', 'nostrict', 2); # full context report
$a->warning();

$error->report_layout('REPORT',E_ERROR_ALL,'SOURCE');
$error->report_layout('CONTEXT', 'strict', 2); # strict context report
$a->error();

$error->report_layout('CONTEXT', 'nostrict', 10); # full context report
include('no such file.');

/* the following function-call causes error which can not be hanlded by
ErrorHandler(), but you can still play with SILENT REPORT and LOG REPORT. */
# above you can see that multiline /* */ comments may still cause problems.
no_such_function();
?>