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 straightforward testing, simply by trying out all the operations your application provides. Handling them is just a matter of correcting the code.
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. Running 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 ...