The rules for code blocks within a language dictate where you can declare variables, how you "bracket" code, etc.
PHP Code Blocks
In .PHP html pages, you embed PHP code between <?PHP and ?>.
For PHP, JavaScript, Java,and C++, I prefer to put the first { at the end of the first line of the code block as in the example above because I see morePHP codeformatted that way (and on PHP.Net).
PHP Alternative Syntax
Although I don't like to use it, PHP offers an alternative syntax for if, while, for, foreach, and switch. These code blocks are surrounded by statement ending keywords that all use End with camel caps such as endif, endwhile, endfor, endforeach,and endswitch.