How can error reporting be enabled in PHP to help debug code?

Error reporting in PHP can be enabled by setting the error_reporting directive in the php.ini file or by using the error_reporting() function in your PHP code. This will help display any errors or warnings that occur during script execution, making it easier to debug and fix issues in your code.

// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);