PHP supports the set_error_handler() and trigger_error() function in order to allow you to easily trap application errors.

<?php 
function get_error($errno$errstr$errfile$errline) {
    echo 
"Danger! Danger Will Robinson!";
    echo 
"error in $errfile on $errline [$errno]: $errstr\n";
}

set_error_handler('get_error');

$d 0;
print 
$d;
?>
Output