Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class ErrHandl {
  4.     public function __construct() {
  5.         $this->registerHandler();
  6.     }
  7.  
  8.     public function registerHandler() {
  9.         set_error_handler([$this, 'errorHandler']);
  10.     }
  11.  
  12.     public function errorHandler() {
  13.         $this->registerHandler();
  14.         echo 'oh no, an error!';
  15.     }
  16. }
  17.  
  18. //------
  19.  
  20. $errHandl = new ErrHandl();
  21.  
  22. trigger_error('test');
  23. echo 'still alive!';
  24. trigger_error('test2');
  25.  
  26. echo 'works, thanks to re-registering...';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement