I\'m trying to do the following:
try {
// just an example
$time = \'wrong datatype\';
$timestamp = date(\"Y-m-d H:i:s\", $time);
} catch (Ex
Use ErrorException to turn errors into exceptions to handle:
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");
try {
// just an example
$time = 'wrong datatype';
if (false === $timestamp = date("Y-m-d H:i:s", $time)) {
throw new Exception('date error');
}
} catch (Exception $e) {
return false;
}