CHAPTER 7 – TYPES OF ERRORS
Programming Errors Sometimes errors occur due to errors in our code. In some ways, these are the easiest errors to deal with because they can be uncovered mostly by straight- forward testing, simply by trying out all the operations your application pro- vides. Handling them is just a matter of correcting the code. Syntax/Parse Errors Syntax errors and other parse errors are caught when a file is compiled, before PHP starts executing it at all <?php print "Hello!n"; <gobbledigook/> ?> This example contains an XML tag where PHP expects to find code. Run- ning this results in an error: Parse error: parse error in test.php on line 4 As you can see, the script did not even print Hello! before displaying an error message, because the syntax error was discovered during compilation, before PHP started executing the script.