Php - Exception

Card Puncher Data Processing

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 !');





Discover More
Card Puncher Data Processing
How to catch a php error (E_WARNING or E_ERROR) ?

This howto shows you how to catch an php error. The general procedure is to: create a exception to throw when an error happens replace the general error handling function with our own that throw...
Php Error Level Enotice Not Set
Php - Error

This page is the standard error handling system of php known also as the error functions. This system: triggers error at a certain level that may be caught via a global callback function. ...



Share this page:
Follow us:
Task Runner