Codes start with either <?php or <? depending upon your PHP setup. The first is the global way, the second is an alternative (called "short tags") and isn't guaranteed to be enabled on every server.
The ending tag is ?> (note no PHP) and delimits that the PHP parser should stop parsing at that point.
You can chunk code like:
// This is the first chunk
<!-- Some HTML code would be in here -->
/// This is the second chunk
and the parser would do all the code.
With PHP, each line is ended with a semicolon (. If you don't end your line with it, you get a parse error, then you have to go find where you missed it.
You can of course read all this and more in the manual (linked above).