PHP Debugging Techniques
Debugging a PHP script—debugging it efficiently, at least—boils down to understanding the normal causes of errors. Table 9.1 lists the likely reasons for the most common PHP errors.
Common PHP Errors | |
---|---|
ERROR | LIKELY CAUSE |
Parse error | Missing semicolon, unbalanced curly braces, parentheses, or quotation marks, or use of an unescaped quotation mark in a string. |
Empty variable value | Forgot the initial $, misspelled or miscapitalized the variable name, inappropriate variable scope, or the register_globals setting is turned off. |
Undefined variable | Reference made to a variable before it is given a value. |
Call to undefined function ... |
Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.