When writing PHP, there are a number of things to remember. If you forget these, you'll find yourself knee deep in syntax errors.
- Be careful to use quotation marks, parentheses, and brackets in pairs. If unbalanced, your code will generate confusing syntax errors, usually pointing to a line different from the one with the problem.
- End most lines of code with a semicolon (;). A semicolon is an statement seperator rather than a statement end mark, so it doesn't have to follow every statement. In practice, however, you should end every statement with a semicolon.
- Although many PHP language constructs are not case sensitive, function and variable names are so it is best to get in the habbit of using consistent case. I use lowercase letters for all PHP constructs, functions and variables names with a few exceptions (noted later).
- Extra blank spaces are not significant in PHP - your code may have spaces and tabs to make it more human-readable without having to worry that it will alter the output.
Copyright © 2003
Henry H. Hartley
All Rights Reserved