Ciao.
Un banale esempio:

Codice PHP:
<?php
function stringUpperCase($str) {
       if (!
is_string($str)) {
            
trigger_error("I need a string ;) "E_USER_ERROR);
        } 
        return 
strtoupper($str);
}
function 
myErrorHandler($errnum$errmsg$file$lineno) {
    if(
$errnum == E_USER_ERROR) {
        print 
"error: $errmsg\n
"
;
        print 
"file: $file\n
"
;
        print 
"line: $lineno\n
"
;
        exit();
    }
}

$handler set_error_handler('myErrorHandler'); 
$upstringUpperCase(1);
?>
set_error_handler