3v4l.org

run code in 500+ PHP versions simultaneously
<?php set_exception_handler(function (\Throwable $exception) { echo 'Caught: ' . $exception->getMessage() . "\n"; }); set_error_handler(static function (int $severity, string $msg, string $file, int $line): bool { if ((error_reporting() & ~(\PHP_MAJOR_VERSION >= 8 ? 4437 : 0)) === 0) { return false; } echo 'Caught error: ' . $msg . "\n"; return true; }); register_shutdown_function(function () { trigger_error('warn_shutdown_1', \E_USER_WARNING); }); register_shutdown_function(function () { trigger_error('warn_shutdown_2', \E_USER_WARNING); }); register_shutdown_function(function () { throw new \Exception('ex_shutdown_1'); }); register_shutdown_function(function () { // expected to be never executed as after 1 uncaught exception php invokes shutdown, // after 1 uncaught exception in shutdown, php terminates throw new \Exception('ex_shutdown_2'); }); trigger_error('warn_regular_1', \E_USER_WARNING); trigger_error('warn_regular_2', \E_USER_WARNING); throw new \Exception('ex_regular');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/lXRcY
function name:  (null)
number of ops:  37
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'set_exception_handler'
          1        DECLARE_LAMBDA_FUNCTION                              ~0      [0]
    5     2        SEND_VAL                                                     ~0
    3     3        DO_ICALL                                                     
    6     4        INIT_FCALL                                                   'set_error_handler'
          5        DECLARE_LAMBDA_FUNCTION                              ~2      [1]
   13     6        SEND_VAL                                                     ~2
    6     7        DO_ICALL                                                     
   15     8        INIT_FCALL                                                   'register_shutdown_function'
          9        DECLARE_LAMBDA_FUNCTION                              ~4      [2]
   17    10        SEND_VAL                                                     ~4
   15    11        DO_ICALL                                                     
   19    12        INIT_FCALL                                                   'register_shutdown_function'
         13        DECLARE_LAMBDA_FUNCTION                              ~6      [3]
   21    14        SEND_VAL                                                     ~6
   19    15        DO_ICALL                                                     
   23    16        INIT_FCALL                                                   'register_shutdown_function'
         17        DECLARE_LAMBDA_FUNCTION                              ~8      [4]
   25    18        SEND_VAL                                                     ~8
   23    19        DO_ICALL                                                     
   27    20        INIT_FCALL                                                   'register_shutdown_function'
         21        DECLARE_LAMBDA_FUNCTION                              ~10     [5]
   31    22        SEND_VAL                                                     ~10
   27    23        DO_ICALL                                                     
   33    24        INIT_FCALL                                                   'trigger_error'
         25        SEND_VAL                                                     'warn_regular_1'
         26        SEND_VAL                                                     512
         27        DO_ICALL                                                     
   34    28        INIT_FCALL                                                   'trigger_error'
         29        SEND_VAL                                                     'warn_regular_2'
         30        SEND_VAL                                                     512
         31        DO_ICALL                                                     
   36    32        NEW                                                  $14     'Exception'
         33        SEND_VAL_EX                                                  'ex_regular'
         34        DO_FCALL                                          0          
         35      > THROW                                             0          $14
         36*     > 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/lXRcY
function name:  {closure:/in/lXRcY:3}
number of ops:  7
compiled vars:  !0 = $exception
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_METHOD_CALL                                             !0, 'getMessage'
          2        DO_FCALL                                          0  $1      
          3        CONCAT                                               ~2      'Caught%3A+', $1
          4        CONCAT                                               ~3      ~2, '%0A'
          5        ECHO                                                         ~3
    5     6      > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
Branch analysis from position: 15
filename:       /in/lXRcY
function name:  {closure:/in/lXRcY:6}
number of ops:  21
compiled vars:  !0 = $severity, !1 = $msg, !2 = $file, !3 = $line
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
    7     4        INIT_FCALL                                                   'error_reporting'
          5        DO_ICALL                                             $4      
          6      > JMPZ                                                         <true>, ->9
          7    >   QM_ASSIGN                                            ~5      4437
          8      > JMP                                                          ->10
          9    >   QM_ASSIGN                                            ~5      0
         10    >   BW_NOT                                               ~6      ~5
         11        BW_AND                                               ~7      $4, ~6
         12        IS_IDENTICAL                                                 ~7, 0
         13      > JMPZ                                                         ~8, ->15
    8    14    > > RETURN                                                       <false>
   11    15    >   CONCAT                                               ~9      'Caught+error%3A+', !1
         16        CONCAT                                               ~10     ~9, '%0A'
         17        ECHO                                                         ~10
   12    18      > RETURN                                                       <true>
   13    19*       VERIFY_RETURN_TYPE                                           
         20*     > RETURN                                                       null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lXRcY
function name:  {closure:/in/lXRcY:15}
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                                   'trigger_error'
          1        SEND_VAL                                                     'warn_shutdown_1'
          2        SEND_VAL                                                     512
          3        DO_ICALL                                                     
   17     4      > RETURN                                                       null

End of Dynamic Function 2

Dynamic Function 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lXRcY
function name:  {closure:/in/lXRcY:19}
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                                   'trigger_error'
          1        SEND_VAL                                                     'warn_shutdown_2'
          2        SEND_VAL                                                     512
          3        DO_ICALL                                                     
   21     4      > RETURN                                                       null

End of Dynamic Function 3

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

End of Dynamic Function 4

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

End of Dynamic Function 5

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
130.35 ms | 492 KiB | 12 Q