What are the best practices for writing if-else statements in PHP to avoid errors and warnings?

When writing if-else statements in PHP, it's important to ensure that all conditions are properly structured to avoid errors and warnings. One common mistake is not using proper syntax, such as missing parentheses or curly braces. To prevent issues, always double-check the logic of your conditions and make sure to include the necessary punctuation.

// Example of a correct if-else statement in PHP
$number = 10;

if ($number > 5) {
    echo "Number is greater than 5";
} else {
    echo "Number is not greater than 5";
}