3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Logger { public function log() { set_error_handler('count'); echo __METHOD__ . "\n"; restore_error_handler(); } } function first_error_handler() { echo __FUNCTION__ . "\n"; } class ErrorHandler { public function handleError() { echo __METHOD__ . "\n"; (new Logger())->log(); } } set_error_handler('first_error_handler'); set_error_handler([new ErrorHandler(), 'handleError']); trigger_error('AN ERROR', E_USER_DEPRECATED); var_dump(set_error_handler(null));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4OZNZ
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'first_error_handler'
          2        DO_ICALL                                                 
   27     3        INIT_FCALL                                               'set_error_handler'
          4        NEW                                              $1      'ErrorHandler'
          5        DO_FCALL                                      0          
          6        INIT_ARRAY                                       ~3      $1
          7        ADD_ARRAY_ELEMENT                                ~3      'handleError'
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                                 
   29    10        INIT_FCALL                                               'trigger_error'
         11        SEND_VAL                                                 'AN+ERROR'
         12        SEND_VAL                                                 16384
         13        DO_ICALL                                                 
   31    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'set_error_handler'
         16        SEND_VAL                                                 null
         17        DO_ICALL                                         $6      
         18        SEND_VAR                                                 $6
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function first_error_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4OZNZ
function name:  first_error_handler
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                     'first_error_handler%0A'
   15     1      > RETURN                                                   null

End of function first_error_handler

Class Logger:
Function log:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4OZNZ
function name:  log
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'count'
          2        DO_ICALL                                                 
    7     3        ECHO                                                     'Logger%3A%3Alog%0A'
    8     4        INIT_FCALL                                               'restore_error_handler'
          5        DO_ICALL                                                 
    9     6      > RETURN                                                   null

End of function log

End of class Logger.

Class ErrorHandler:
Function handleerror:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4OZNZ
function name:  handleError
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ECHO                                                     'ErrorHandler%3A%3AhandleError%0A'
   21     1        NEW                                              $0      'Logger'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'log'
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function handleerror

End of class ErrorHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
1486.19 ms | 1013 KiB | 17 Q