Page 1 of 1

Exceptions give parse error!!

Posted: Mon Jul 03, 2006 2:05 pm
by Skara
... I can't even run the example code from php.net:

Entire file:

Code: Select all

<?php
try {
   $error = 'Always throw this error';
   throw new Exception($error);

   // Code following an exception is not executed.
   echo 'Never executed';

} catch (Exception $e) {
   echo 'Caught exception: ',  $e->getMessage(), "\n";
}

// Continue execution
echo 'Hello World';
?>
Parse error: parse error, unexpected '{' in /path/to/ex.php on line 2
I have php 4.3.11

Posted: Mon Jul 03, 2006 2:23 pm
by Weirdan
Exceptions are supported in PHP5+ only

Posted: Mon Jul 03, 2006 2:24 pm
by Skara
Well I feel kinda dumb. :oops: