- array_search: documentation ( source)
- set_error_handler: documentation ( source)
<?php
function foo($foo) {
echo "Executing foo\n";
}
set_error_handler(function($errno, $errstr) {
throw new Exception(array_search($errno, $errors) . ": " . $errstr);
});
try {
foo();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}