3v4l.org

run code in 300+ PHP versions simultaneously
<?php function exception_error_handler($severity, $message, $file, $line) { if (!(error_reporting() & $severity)) { // This error code is not included in error_reporting return; } throw new ErrorException($message, 0, $severity, $file, $line); } set_error_handler("exception_error_handler"); $o=new STDClass(); $o->f=function(){ echo "i ran!"; }; try{ call_user_func($o->f,[]); }catch(Throwable $ex){ echo 'didn\'t work: $o->f()',PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cGZDG
function name:  (null)
number of ops:  18
compiled vars:  !0 = $o, !1 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'exception_error_handler'
          2        DO_ICALL                                                 
   11     3        NEW                                              $3      'STDClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   12     6        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
          7        ASSIGN_OBJ                                               !0, 'f'
   14     8        OP_DATA                                                  ~7
   16     9        FETCH_OBJ_R                                      ~8      !0, 'f'
         10        INIT_USER_CALL                                1          'call_user_func', ~8
         11        SEND_USER                                                <array>
         12        DO_FCALL                                      0          
         13      > JMP                                                      ->17
   17    14  E > > CATCH                                       last         'Throwable'
   18    15    >   ECHO                                                     'didn%27t+work%3A+%24o-%3Ef%28%29'
         16        ECHO                                                     '%0A'
   19    17    > > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cGZDG
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'i+ran%21'
   14     1      > RETURN                                                   null

End of Dynamic Function 0

Function exception_error_handler:
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
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/cGZDG
function name:  exception_error_handler
number of ops:  19
compiled vars:  !0 = $severity, !1 = $message, !2 = $file, !3 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    3     4        INIT_FCALL                                               'error_reporting'
          5        DO_ICALL                                         $4      
          6        BW_AND                                           ~5      !0, $4
          7        BOOL_NOT                                         ~6      ~5
          8      > JMPZ                                                     ~6, ->10
    5     9    > > RETURN                                                   null
    7    10    >   NEW                                              $7      'ErrorException'
         11        SEND_VAR_EX                                              !1
         12        SEND_VAL_EX                                              0
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !2
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0          
         17      > THROW                                         0          $7
    8    18*     > RETURN                                                   null

End of function exception_error_handler

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.74 ms | 1011 KiB | 15 Q