What are some common debugging techniques for PHP scripts, especially when using the debug_mode setting?

When debugging PHP scripts, especially when using the debug_mode setting, some common techniques include using var_dump() or print_r() to display variable values, checking error logs for any PHP errors or warnings, using die() or exit() to halt script execution at specific points for inspection, and utilizing a debugger tool like Xdebug for more advanced debugging capabilities.

// Example code snippet using var_dump() to display variable values
$debug_mode = true;

if ($debug_mode) {
    var_dump($variable_to_debug);
}