>
Instructions are separated the same as in C or perl - terminate each statement with a semicolon.
The closing tag (?>) also implies the end of the statement, so the following are equivalent:
1: <?php
2: echo "This is a test";
3: ?>
4: <?php echo "This is a test" ?>
Comments
PHP supports ’C’, ’C++’ and Unix shell-style comments. For example:
1: <?php
2: echo "This is a test"; // This is a one-line c++ style comment
3: /* This is a multi line comment
4: yet another line of comment */
5: echo "This is yet another test";
6: echo "One Final Test"; # This is shell-style style comment
7: ?>
The "one-line" comment styles actually only comment to the end of the line or the current block of PHP
code, whichever comes first.
1: <h1>This is an <?# echo "simple";?> example.</h1>
2: <p>The header above will say ’This is an example’.
You should be careful not to nest ’C’ style comments, which can happen when commenting out large
blocks.
1: <?php
2: /*
3: echo "This is a test"; /* This comment will cause a problem */
4: */
5: ?>