Q&A
-
Which are the best start and end tags to use?
-
It is largely a matter of preference. For the sake of portability, the standard tags (<?php and ?>) are probably the safest choice. Short tags are enabled by default and have the virtue of brevity, but to promote portability, it might be safest to avoid them.
-
Which editors should I avoid when creating PHP code?
-
Do not use word processors that format text for printing (such as Word or OpenOffice). Even if you save files created using this type of editor in plain text format, hidden characters can creep into your code.
-
When should I comment my code?
-
This is a matter of preference once again. Some short scripts will be self-explanatory to you, even after a long interval. For scripts of any length or complexity, you should comment your code. This will save you time and frustration in the long run.