Many servers do not display PHP errors by default, so many times when not getting the expected result or performance we donĀ“t know which line of code is giving error.
With the following functions placed at the beginning of our PHP files we will show the PHP errors:
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?>
Additionally I put more example code to show or not to display the errors of PHP:
<?php // Show all PHP errors error_reporting(-1); // Do not show PHP errors error_reporting(0); // Show all PHP errors error_reporting(E_ALL); // Show all PHP errors ini_set('error_reporting', E_ALL); ?>