3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stack_exception_handler($eh) { static $ehs=array(); if (empty($ehs)) { set_exception_handler(function($ex)use(&$ehs){foreach($ehs as $eh){call_user_func($eh,$ex);}}); } $ehs[]=$eh; register_postsend_function(function() { restore_exception_handler(); restore_error_handler(); }); } stack_exception_handler(function(){echo "handler 1 called!";}); stack_exception_handler(function(){echo "handler 2 called!";}); stack_exception_handler(function(){echo "handler 3 called!";});
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5FIc
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'stack_exception_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft5FIc%3A10%242'
          2        SEND_VAL                                                 ~0
          3        DO_FCALL                                      0          
   11     4        INIT_FCALL                                               'stack_exception_handler'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft5FIc%3A11%243'
          6        SEND_VAL                                                 ~2
          7        DO_FCALL                                      0          
   12     8        INIT_FCALL                                               'stack_exception_handler'
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft5FIc%3A12%244'
         10        SEND_VAL                                                 ~4
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function stack_exception_handler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/t5FIc
function name:  stack_exception_handler
number of ops:  16
compiled vars:  !0 = $eh, !1 = $ehs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        BIND_STATIC                                              !1
    4     2        ISSET_ISEMPTY_CV                                         !1
          3      > JMPZ                                                     ~2, ->9
    5     4    >   INIT_FCALL                                               'set_exception_handler'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft5FIc%3A5%240'
          6        BIND_LEXICAL                                             ~3, !1
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
    7     9    >   ASSIGN_DIM                                               !1
         10        OP_DATA                                                  !0
    8    11        INIT_FCALL_BY_NAME                                       'register_postsend_function'
         12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft5FIc%3A8%241'
         13        SEND_VAL_EX                                              ~6
         14        DO_FCALL                                      0          
    9    15      > RETURN                                                   null

End of function stack_exception_handler

Function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/t5FIc
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $ex, !1 = $ehs, !2 = $eh
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2      > FE_RESET_R                                       $3      !1, ->8
          3    > > FE_FETCH_R                                               $3, !2, ->8
          4    >   INIT_USER_CALL                                1          'call_user_func', !2
          5        SEND_USER                                                !0
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $3
          9      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A5%240

Function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A8%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5FIc
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'restore_exception_handler'
          1        DO_ICALL                                                 
          2        INIT_FCALL                                               'restore_error_handler'
          3        DO_ICALL                                                 
          4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A8%241

Function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A10%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5FIc
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'handler+1+called%21'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A10%242

Function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A11%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5FIc
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'handler+2+called%21'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A11%243

Function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A12%244:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5FIc
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'handler+3+called%21'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft5FIc%3A12%244

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.81 ms | 1403 KiB | 22 Q