fork(1) 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 24448KB
stdin
Standard input is empty
stdout
123
100
int(322)
int(7)
8
Use of undefined constant error - assumed 'error'
/home/2fG09h/prog.php
76
Array
(
    [_GET] => Array
        (
        )

    [_POST] => Array
        (
        )

    [_COOKIE] => Array
        (
        )

    [_FILES] => Array
        (
        )

    [argv] => Array
        (
            [0] => prog.php
        )

    [argc] => 1
    [_SERVER] => Array
        (
            [TMPDIR] => /tmp/CJJ6AI
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [PWD] => /home/2fG09h
            [LANG] => en_US.UTF-8
            [SHLVL] => 0
            [HOME] => /home/2fG09h
            [PHP_SELF] => prog.php
            [SCRIPT_NAME] => prog.php
            [SCRIPT_FILENAME] => prog.php
            [PATH_TRANSLATED] => prog.php
            [DOCUMENT_ROOT] => 
            [REQUEST_TIME_FLOAT] => 1426275621.6386
            [REQUEST_TIME] => 1426275621
            [argv] => Array
                (
                    [0] => prog.php
                )

            [argc] => 1
        )

    [z] => test Object
        (
            [a] => 100
            [b] => 222
            [c] => 641
        )

    [x] => 322
    [y] => 7
)