- set_error_handler: documentation ( source)
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new Exception('Hello world');
}
set_error_handler("exception_error_handler");
try {
// try loading a file that does not have exif data:
$results = @exif_read_data('test.txt', 0, true);
} catch (Exception $e) {
echo $e->getMessage(); // "We never get here..."
};