3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myErrorHandler($errno, $errstr, $errfile, $errline) { if (!(error_reporting() & $errno)) { // This error code is not included in error_reporting return; } switch ($errno) { case E_USER_ERROR: echo "<b>My ERROR</b> [$errno] $errstr<br />\n"; echo " Fatal error on line $errline in file $errfile"; echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo "Aborting...<br />\n"; exit(1); break; case E_USER_WARNING: echo "<b>My WARNING</b> [$errno] $errstr<br />\n"; break; case E_USER_NOTICE: echo "<b>My NOTICE</b> [$errno] $errstr<br />\n"; break; case E_NOTICE: echo "Notice error type: [$errno] $errstr<br />\n"; break; default: echo "Unknown error type: [$errno] $errstr<br />\n"; break; } /* Don't execute PHP internal error handler */ return true; } function your_err_handler($errno, $errstr, $errfile, $errline, $errcontext) { $l = error_reporting(); if ( $l & $errno ) { $exit = false; switch ( $errno ) { case E_USER_ERROR: $type = 'Fatal Error'; $exit = true; break; case E_USER_WARNING: case E_WARNING: $type = 'Warning'; break; case E_USER_NOTICE: case E_NOTICE: case @E_STRICT: $type = 'Notice'; $exit = true; break; case @E_RECOVERABLE_ERROR: $type = 'Catchable'; break; default: $type = 'Unknown Error'; $exit = true; break; } $exception = new \ErrorException($type.': '.$errstr, 0, $errno, $errfile, $errline); if ( $exit ) { exc_handler($exception); exit(); } else throw $exception; } return false; } function exc_handler($exception) { $log = $exception->getMessage() . "\n" . $exception->getTraceAsString() . LINEBREAK; if ( ini_get('log_errors') ) error_log($log, 0); print("Unhandled Exception" . (DEBUG ? " - $log" : '')); } set_error_handler("your_err_handler"); $p = null; var_dump(isset($p)); var_dump(empty($p)); var_dump(is_null($p)); var_dump(isset($q)); var_dump(empty($q)); try{ var_dump(is_null($q)); } catch (Exception $e) { echo 'not set'; // throw new ErrorException($message, 0, $severity, $file, $line); } echo 'continuing';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 29
Branch analysis from position: 29
2 jumps found. (Code = 107) Position 1 = 30, Position 2 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FH46U
function name:  (null)
number of ops:  33
compiled vars:  !0 = $p, !1 = $q, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   87     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'your_err_handler'
          2        DO_ICALL                                                 
   88     3        ASSIGN                                                   !0, null
   89     4        INIT_FCALL                                               'var_dump'
          5        ISSET_ISEMPTY_CV                                 ~5      !0
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                                 
   90     8        INIT_FCALL                                               'var_dump'
          9        ISSET_ISEMPTY_CV                                 ~7      !0
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
   91    12        INIT_FCALL                                               'var_dump'
         13        TYPE_CHECK                                    2  ~9      !0
         14        SEND_VAL                                                 ~9
         15        DO_ICALL                                                 
   92    16        INIT_FCALL                                               'var_dump'
         17        ISSET_ISEMPTY_CV                                 ~11     !1
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                                 
   93    20        INIT_FCALL                                               'var_dump'
         21        ISSET_ISEMPTY_CV                                 ~13     !1
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                                 
   95    24        INIT_FCALL                                               'var_dump'
         25        TYPE_CHECK                                    2  ~15     !1
         26        SEND_VAL                                                 ~15
         27        DO_ICALL                                                 
         28      > JMP                                                      ->31
   96    29  E > > CATCH                                       last         'Exception'
   97    30    >   ECHO                                                     'not+set'
  100    31    >   ECHO                                                     'continuing'
         32      > RETURN                                                   1

Function myerrorhandler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
6 jumps found. (Code = 187) Position 1 = 20, Position 2 = 35, Position 3 = 42, Position 4 = 49, Position 5 = 56, Position 6 = 11
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 35
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 42
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 49
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 49
Branch analysis from position: 42
Branch analysis from position: 35
Branch analysis from position: 20
filename:       /in/FH46U
function name:  myErrorHandler
number of ops:  65
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    4     4        INIT_FCALL                                               'error_reporting'
          5        DO_ICALL                                         $4      
          6        BW_AND                                           ~5      !0, $4
          7        BOOL_NOT                                         ~6      ~5
          8      > JMPZ                                                     ~6, ->10
    6     9    > > RETURN                                                   null
    9    10    > > SWITCH_LONG                                              !0, [ 256:->20, 512:->35, 1024:->42, 8:->49, ], ->56
         11    >   IS_EQUAL                                                 !0, 256
         12      > JMPNZ                                                    ~7, ->20
         13    >   IS_EQUAL                                                 !0, 512
         14      > JMPNZ                                                    ~7, ->35
         15    >   IS_EQUAL                                                 !0, 1024
         16      > JMPNZ                                                    ~7, ->42
         17    >   IS_EQUAL                                                 !0, 8
         18      > JMPNZ                                                    ~7, ->49
         19    > > JMP                                                      ->56
   11    20    >   ROPE_INIT                                     5  ~9      '%3Cb%3EMy+ERROR%3C%2Fb%3E+%5B'
         21        ROPE_ADD                                      1  ~9      ~9, !0
         22        ROPE_ADD                                      2  ~9      ~9, '%5D+'
         23        ROPE_ADD                                      3  ~9      ~9, !1
         24        ROPE_END                                      4  ~8      ~9, '%3Cbr+%2F%3E%0A'
         25        ECHO                                                     ~8
   12    26        ROPE_INIT                                     4  ~13     '++Fatal+error+on+line+'
         27        ROPE_ADD                                      1  ~13     ~13, !3
         28        ROPE_ADD                                      2  ~13     ~13, '+in+file+'
         29        ROPE_END                                      3  ~12     ~13, !2
         30        ECHO                                                     ~12
   13    31        ECHO                                                     '%2C+PHP+8.0.0+%28Linux%29%3Cbr+%2F%3E%0A'
   14    32        ECHO                                                     'Aborting...%3Cbr+%2F%3E%0A'
   15    33      > EXIT                                                     1
   16    34*       JMP                                                      ->63
   19    35    >   ROPE_INIT                                     5  ~16     '%3Cb%3EMy+WARNING%3C%2Fb%3E+%5B'
         36        ROPE_ADD                                      1  ~16     ~16, !0
         37        ROPE_ADD                                      2  ~16     ~16, '%5D+'
         38        ROPE_ADD                                      3  ~16     ~16, !1
         39        ROPE_END                                      4  ~15     ~16, '%3Cbr+%2F%3E%0A'
         40        ECHO                                                     ~15
   20    41      > JMP                                                      ->63
   23    42    >   ROPE_INIT                                     5  ~20     '%3Cb%3EMy+NOTICE%3C%2Fb%3E+%5B'
         43        ROPE_ADD                                      1  ~20     ~20, !0
         44        ROPE_ADD                                      2  ~20     ~20, '%5D+'
         45        ROPE_ADD                                      3  ~20     ~20, !1
         46        ROPE_END                                      4  ~19     ~20, '%3Cbr+%2F%3E%0A'
         47        ECHO                                                     ~19
   24    48      > JMP                                                      ->63
   27    49    >   ROPE_INIT                                     5  ~24     'Notice+error+type%3A+%5B'
         50        ROPE_ADD                                      1  ~24     ~24, !0
         51        ROPE_ADD                                      2  ~24     ~24, '%5D+'
         52        ROPE_ADD                                      3  ~24     ~24, !1
         53        ROPE_END                                      4  ~23     ~24, '%3Cbr+%2F%3E%0A'
         54        ECHO                                                     ~23
   28    55      > JMP                                                      ->63
   31    56    >   ROPE_INIT                                     5  ~28     'Unknown+error+type%3A+%5B'
         57        ROPE_ADD                                      1  ~28     ~28, !0
         58        ROPE_ADD                                      2  ~28     ~28, '%5D+'
         59        ROPE_ADD                                      3  ~28     ~28, !1
         60        ROPE_END                                      4  ~27     ~28, '%3Cbr+%2F%3E%0A'
         61        ECHO                                                     ~27
   32    62      > JMP                                                      ->63
   36    63    > > RETURN                                                   <true>
   37    64*     > RETURN                                                   null

End of function myerrorhandler

Function your_err_handler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 60
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 33
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 33
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 35
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 38
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 59
Branch analysis from position: 54
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 59
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 35
Branch analysis from position: 35
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 33
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FH46U
function name:  your_err_handler
number of ops:  62
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline, !4 = $errcontext, !5 = $l, !6 = $exit, !7 = $type, !8 = $exception
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   40     5        INIT_FCALL                                               'error_reporting'
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !5, $9
   41     8        BW_AND                                           ~11     !5, !0
          9      > JMPZ                                                     ~11, ->60
   43    10    >   ASSIGN                                                   !6, <false>
   44    11        IS_EQUAL                                                 !0, 256
         12      > JMPNZ                                                    ~13, ->30
         13    >   IS_EQUAL                                                 !0, 512
         14      > JMPNZ                                                    ~13, ->33
         15    >   IS_EQUAL                                                 !0, 2
         16      > JMPNZ                                                    ~13, ->33
         17    >   IS_EQUAL                                                 !0, 1024
         18      > JMPNZ                                                    ~13, ->35
         19    >   IS_EQUAL                                                 !0, 8
         20      > JMPNZ                                                    ~13, ->35
   55    21    >   BEGIN_SILENCE                                    ~14     
         22        END_SILENCE                                              ~14
         23        IS_EQUAL                                                 !0, 2048
         24      > JMPNZ                                                    ~13, ->35
   59    25    >   BEGIN_SILENCE                                    ~15     
         26        END_SILENCE                                              ~15
         27        IS_EQUAL                                                 !0, 4096
         28      > JMPNZ                                                    ~13, ->38
         29    > > JMP                                                      ->40
   46    30    >   ASSIGN                                                   !7, 'Fatal+Error'
   47    31        ASSIGN                                                   !6, <true>
   48    32      > JMP                                                      ->43
   51    33    >   ASSIGN                                                   !7, 'Warning'
   52    34      > JMP                                                      ->43
   56    35    >   ASSIGN                                                   !7, 'Notice'
   57    36        ASSIGN                                                   !6, <true>
   58    37      > JMP                                                      ->43
   60    38    >   ASSIGN                                                   !7, 'Catchable'
   61    39      > JMP                                                      ->43
   63    40    >   ASSIGN                                                   !7, 'Unknown+Error'
   64    41        ASSIGN                                                   !6, <true>
   65    42      > JMP                                                      ->43
   68    43    >   NEW                                              $24     'ErrorException'
         44        CONCAT                                           ~25     !7, '%3A+'
         45        CONCAT                                           ~26     ~25, !1
         46        SEND_VAL_EX                                              ~26
         47        SEND_VAL_EX                                              0
         48        SEND_VAR_EX                                              !0
         49        SEND_VAR_EX                                              !2
         50        SEND_VAR_EX                                              !3
         51        DO_FCALL                                      0          
         52        ASSIGN                                                   !8, $24
   70    53      > JMPZ                                                     !6, ->59
   71    54    >   INIT_FCALL_BY_NAME                                       'exc_handler'
         55        SEND_VAR_EX                                              !8
         56        DO_FCALL                                      0          
   72    57      > EXIT                                                     
         58*       JMP                                                      ->60
   75    59    > > THROW                                         0          !8
   77    60    > > RETURN                                                   <false>
   78    61*     > RETURN                                                   null

End of function your_err_handler

Function exc_handler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/FH46U
function name:  exc_handler
number of ops:  28
compiled vars:  !0 = $exception, !1 = $log
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   80     0  E >   RECV                                             !0      
   81     1        INIT_METHOD_CALL                                         !0, 'getMessage'
          2        DO_FCALL                                      0  $2      
          3        CONCAT                                           ~3      $2, '%0A'
          4        INIT_METHOD_CALL                                         !0, 'getTraceAsString'
          5        DO_FCALL                                      0  $4      
          6        CONCAT                                           ~5      ~3, $4
          7        FETCH_CONSTANT                                   ~6      'LINEBREAK'
          8        CONCAT                                           ~7      ~5, ~6
          9        ASSIGN                                                   !1, ~7
   82    10        INIT_FCALL                                               'ini_get'
         11        SEND_VAL                                                 'log_errors'
         12        DO_ICALL                                         $9      
         13      > JMPZ                                                     $9, ->18
   83    14    >   INIT_FCALL                                               'error_log'
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 0
         17        DO_ICALL                                                 
   84    18    >   FETCH_CONSTANT                                   ~11     'DEBUG'
         19      > JMPZ                                                     ~11, ->24
         20    >   NOP                                                      
         21        FAST_CONCAT                                      ~12     '+-+', !1
         22        QM_ASSIGN                                        ~13     ~12
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~13     ''
         25    >   CONCAT                                           ~14     'Unhandled+Exception', ~13
         26        ECHO                                                     ~14
   85    27      > RETURN                                                   null

End of function exc_handler

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.28 ms | 1416 KiB | 23 Q