What are common pitfalls when using if-else conditions in PHP scripts?

One common pitfall when using if-else conditions in PHP scripts is forgetting to include the curly braces {} for the code block within the condition. This can lead to unexpected behavior or errors in the script. To avoid this, always use curly braces to enclose the code block within an if or else statement.

// Incorrect way without using curly braces
if ($condition)
    echo "Condition is true";
    echo "This will always be executed, regardless of the condition";

// Correct way using curly braces
if ($condition) {
    echo "Condition is true";
}
echo "This will only be executed if the condition is true";