According the PHP Manual: Internal PHP functions mainly use Error reporting, only modern Object oriented extensions use exceptions. However, errors can be simply translated to exceptions with ErrorException
The example provided in ErrorException:
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
It seems to allow using Exceptions instead of the default error reporting. My question is, is this an encouragement or merely an option for us?
Moreover, which is a better practice, use Exception alone like the above example, or use both Exception (set_exception_handler) and Error reporting (set_error_handler) alongside with each other?