Are there exceptions to the rule of using semicolons after each line in PHP?

In PHP, semicolons are required at the end of each statement to indicate the end of a line of code. However, there are a few exceptions to this rule. One exception is when using control structures like loops or conditionals, where the curly braces {} can be used to group multiple statements together without needing a semicolon after each line. Another exception is when using the shorthand syntax for control structures like if and foreach, where the semicolon is not required after each line.

<?php

// Example of using curly braces to group multiple statements without semicolons
if ($condition) {
    echo "Statement 1";
    echo "Statement 2";
}

// Example of using shorthand syntax without semicolons after each line
foreach ($array as $value):
    echo $value;
endforeach;

?>