Adding a semicolon essentially ends the if block before curly braces. This is not true, just that you are not doing anything in if.
Think about it if you don't have braces:
if($a>1) echo "Yes"; echo "No";
does everything until the first semicolony inside if. So in your case, nothing happens until the first half-colony, so nothing happens.
source share