What is the alternative IF syntax in PHP and how does it work?

The alternative IF syntax in PHP provides a more concise and readable way to write conditional statements. It uses a colon (:) to replace the opening curly brace ({) and the keyword "endif" to replace the closing curly brace (}). This syntax can be especially useful when working with HTML templates or other situations where readability is important.

// Standard IF syntax
if ($condition) {
    echo "Condition is true";
} else {
    echo "Condition is false";
}

// Alternative IF syntax
if ($condition):
    echo "Condition is true";
else:
    echo "Condition is false";
endif;