What are common debugging techniques in PHP when encountering errors?

Common debugging techniques in PHP include using error reporting functions like error_reporting() and ini_set(), checking for syntax errors, using print_r() or var_dump() to inspect variables, and utilizing tools like Xdebug for more advanced debugging capabilities.

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

// Check for syntax errors
if (syntax_error) {
    echo "Syntax error found";
}

// Inspect variables
$variable = "value";
print_r($variable);

// Use Xdebug for advanced debugging
xdebug_start_trace();