PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Indrek Altpere   Simple error handling class   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: testing example
Class: Simple error handling class
Intercept and log PHP execution errors
Author: By
Last change: Added few example lines how to use SetDieLevel function and a dummy class that has static and non-static functions to display the usage of setting class methods to be called instead of global functions
Date: 15 years ago
Size: 895 bytes


Class file image Download
require_once 'ErrorManager.php';

die0() {
'died in global function';

Call {
  public static function
die1() {
'died in static function';
  public function
die2() {
'died in class function';
ErrorManager::SetLogLevel(E_ALL | E_STRICT, true);
ErrorManager::SetDebug(true, false);//echo debug data and do it between <pre></pre> tags
//different correct implementation of SetDieLevel
//remove or modify exiting levels to let the script execute beyond first error
ErrorManager::SetDieLevel(E_WARNING, 'die0');
//ErrorManager::SetDieLevel(E_WARNING, array('Call', 'die1'));
//ErrorManager::SetDieLevel(E_WARNING, array(new Call(), 'die2'));
echo 'going to do 1/0 ';
$a = 1 / 0;
'going to do incorrect function call for str_replace ';
$b = str_replace('test', 'test');