What are best practices for debugging PHP code to identify and resolve issues?

Issue: When debugging PHP code, it is important to use tools like var_dump() and print_r() to print out the values of variables and arrays to understand their current state and identify any issues. PHP Code Snippet:

// Debugging example using var_dump()
$variable = "Hello World";
var_dump($variable);

// Debugging example using print_r()
$array = array("apple", "banana", "cherry");
print_r($array);