How can PHP error reporting and debugging tools be used to troubleshoot issues when adding new code to an existing system?

When adding new code to an existing system, it's important to use PHP error reporting and debugging tools to troubleshoot any issues that may arise. One common approach is to enable error reporting in PHP by setting the error_reporting directive to E_ALL. Additionally, using tools like Xdebug can help identify and fix any bugs or errors in the code.

// Enable error reporting in PHP
error_reporting(E_ALL);

// Use Xdebug for debugging
// Example configuration in php.ini:
// zend_extension=xdebug.so
// xdebug.remote_enable=1
// xdebug.remote_host=localhost