PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Andrey Nikishaev   Handling Notice and Warning as Exception   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of use
Class: Handling Notice and Warning as Exception
Throw exceptions when PHP warnings are triggered
Author: By
Last change:
Date: 13 years ago
Size: 249 bytes
 

Contents

Class file image Download
include_once('nwexceptions.php');
 
$a = array();
try {
    print $a['agon'];
} catch (NoticeException $e) {
    print 'FIRST ERROR: '.$e;
}
 
try {
    include('a.php');
} catch (WarningException $e) {
    print 'SECOND ERROR: '.$e;
}