Skip to Main Content
PHP in a Nutshell
book

PHP in a Nutshell

by Paul Hudson
October 2005
Intermediate to advanced content levelIntermediate to advanced
372 pages
11h 35m
English
O'Reilly Media, Inc.
Content preview from PHP in a Nutshell

Abnormal Script Termination

Most scripts will execute from start to finish, but sometimes they might end prematurely. There is a variety of reasons why this will happen:

  1. You've screwed up somewhere, and PHP cannot execute your code.

  2. PHP has screwed up somewhere due to a bug and cannot continue.

  3. Your script has taken too long to execute and gets killed by PHP.

  4. Your script has requested more memory than PHP can allocate and gets killed by PHP.

To be brutally honest, the first situation is unequivocally the most common. This will change a little as your skill with PHP improves, but the first situation is still the most common, even among the most veteran programmers.

Common errors include missing semicolons and parentheses, for example:

    <?php
            $i = 10
            $j = 5;
            if (($i + 2) - ($j + 5) == 10 {
                    print "Success!";
            }
    ?>

The first line is missing a semicolon, which will cause PHP to flag an error on the second line. Also, the second line is missing a parenthesis after "== 10", causing another error.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Cookbook

PHP Cookbook

Eric A. Mann
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 0596100671Errata Page