Section 3.4. Abnormal Script Termination


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



PHP in a Nutshell
Ubuntu Unleashed
ISBN: 596100671
EAN: 2147483647
Year: 2003
Pages: 249

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net