Table of Contents

About

This page is about the Exception feature of Php. 1)

Note that php has also a error reporting feature for the built-in function where you can set an error level.

Management

Caught

The basic structure is:

try {
    echo inverse(5) . "\n";
} catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
} finally {
    echo "First finally.\n";
}

where:

  • catch will run if there is an exception thrown
  • finally will run at the end of the try/catch block.

Throw

throw new Exception('Youla not good !');