3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExceptionHandler { public function __construct() { set_exception_handler($this); } public function __invoke(Exception $e) { echo $exception->getMessage(); } } function error() { throw new Exception('Error'); } set_error_handler('error'); new ExceptionHandler; throw new Exception("Test");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/bcnUk
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'error'
          2        DO_ICALL                                                 
   22     3        NEW                                              $1      'ExceptionHandler'
          4        DO_FCALL                                      0          
          5        FREE                                                     $1
   24     6        NEW                                              $3      'Exception'
          7        SEND_VAL_EX                                              'Test'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $3
         10*     > RETURN                                                   1

Function error:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/bcnUk
function name:  error
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $0      'Exception'
          1        SEND_VAL_EX                                              'Error'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
   19     4*     > RETURN                                                   null

End of function error

Class ExceptionHandler:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bcnUk
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'set_exception_handler'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bcnUk
function name:  __invoke
number of ops:  5
compiled vars:  !0 = $e, !1 = $exception
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_METHOD_CALL                                         !1, 'getMessage'
          2        DO_FCALL                                      0  $2      
          3        ECHO                                                     $2
   13     4      > RETURN                                                   null

End of function __invoke

End of class ExceptionHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.05 ms | 1396 KiB | 17 Q