SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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...';
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top