Programming:Complete PHP/Instruction separation

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

[edit] Rules

  • Each statement inside a PHP block should be concluded with either:
  1. a semicolon AND/OR
  2. a closing PHP tag
    • If you later wanted to move the last line, however, you will need to remember to add the semicolon.
    • If not using a semicolon to terminate the line, the last instruction will include any immediately following newlines (e.g., if part of a HEREDOC).
    • (See this PHP tag discussion for other reasons to close without a closing tag (cookies/sessions or output buffering).)
  • Naturally, there are no instructions to separate outside of PHP blocks (at least for PHP--Javscript or other items may have their own separation instructions).
Personal tools