O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.2. Types of Errors

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

7.2.1.1. 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. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required