Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function exception_error_handler($errno, $errstir, $errfile, $errline ) {
  2. throw new ErrorException($errstr, $errno, 0, $errfile, $errline);;
  3. }
  4. set_error_handler("exception_error_handler");
  5.  
  6. /* Trigger exception */
  7. strpos();
  8.  
  9. function exception_error_handler($errno, $errstir, $errfile, $errline ) {
  10. throw new ErrorException($errstr, $errno, 0, $errfile, $errline);;
  11. }
  12. set_error_handler("exception_error_handler");
  13.  
  14. try {
  15. /* Trigger exception */
  16. strpos();
  17. echo 'No exception was thrown';
  18. }
  19.  
  20. //catch exception
  21. catch(Exception $e) {
  22. echo 'Message: ' .$e->getMessage();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement