PHP quick checklist The main points:
- Always give PHP pages the correct filename extension, normally .php.
- Enclose all PHP script between the correct tags: <?php and ?>.
- Avoid the short form of the opening tag: <?. Using <?php is more reliable.
- PHP variables begin with $ followed by a letter or the underscore character.
- Choose meaningful variable names and remember they’re case-sensitive.
- Use comments to remind you what your script does.
- Remember that numbers don’t require quotes, but strings (text) do.
- You can use single or double quotes, but the outer pair must match.
- Use a backslash to escape quotes of the same type inside a string.
- To store related items together, use an array.
- Use conditional statements, such as if and if... else, for decision making.
- Simplify repetitive tasks with loops.
- Use functions to perform preset tasks.
- Display PHP output with echo or print.
- Inspect the content of arrays with print_r().
- With most error messages, work backward from the position indicated.
- Keep smiling—and remember that PHP is not difficult.
No comments:
Post a Comment