When putting our PHP website online, good practice is not to display errors and notices, because they leave a user with an experience of visiting bad – unprofessional website. Still, when you are visiting your PHP website, you want to have display errors turned on, so you know what went wrong in some cases, and so you can fix them.
There is simple way of turning off and on PHP display errors.
PHP command to display no errors:
error_reporting(0); ini_set('display_errors', false);
PHP command to display errors:
error_reporting(E_ALL); ini_set('display_errors', true);
Depending on user who is visiting website, you can turn on or off error reporting.