What potential pitfalls can arise when working with if and else statements in PHP?

One potential pitfall when working with if and else statements in PHP is forgetting to include curly braces {} around the code blocks. This can lead to unexpected behavior or errors in your code. To avoid this issue, always use curly braces even if there is only one line of code inside the if or else block.

// Incorrect way without curly braces
if ($condition)
    echo "Condition is true";
else
    echo "Condition is false";

// Correct way with curly braces
if ($condition) {
    echo "Condition is true";
} else {
    echo "Condition is false";
}