fork download
  1. <?php
  2. //error_reporting(-1);
  3. error_reporting (E_ALL | E_STRICT);
  4. set_error_handler ('test::php_error_handler');
  5.  
  6.  
  7.  
  8. class test
  9. {
  10. public $a = 123;
  11. public $b = 222;
  12. public $c = 641;
  13.  
  14. static function php_error_handler ($errno, $errstr, $errfile, $errline, $vars) {
  15. throw new Exception ("\n\n".'['.$errno.'] '.$errstr.' ('.strtr ($errfile, '\\', '/').', '.$errline.')'."\n\n");
  16. /*
  17. if (!empty($errno)) {
  18. echo $errno;
  19. echo "\n";
  20. }
  21. if (!empty($errstr)) {
  22. echo $errstr;
  23. echo "\n";
  24. }
  25. if (!empty($errfile)) {
  26. echo $errfile;
  27. echo "\n";
  28. }
  29. if (!empty($errline)) {
  30. echo $errline;
  31. echo "\n";
  32. }
  33. if (!empty($vars)) {
  34. print_r($vars);
  35. echo "\n";
  36. }
  37. */
  38. }
  39.  
  40.  
  41. public function cry() {
  42. echo $this->a;
  43. echo "\n";
  44. }
  45.  
  46. public function summ($a, $b) {
  47.  
  48. if (!empty($a) and !empty($b)) {
  49. return $a + $b;
  50. } else {
  51. return $this->a + $this->b;
  52. }
  53. }
  54.  
  55.  
  56. }
  57.  
  58.  
  59.  
  60. $z = new test();
  61. $z->cry();
  62. $z->a = 100;
  63. $z->cry();
  64. $x = $z->summ(0,0);
  65.  
  66. $y = $z->summ(3, 4);
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. //error;
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
123
100
int(322)
int(7)