Codice PHP:
<?php 
function stringUpperCase($str) { 
       if (!
is_string($str)) { 
            return 
false
        } 
        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); 
if(!
$up){
    
trigger_error("I need a string ;) "E_USER_ERROR);
}
?>
Se sei su php5 poi usare exceptions