3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($errno, $errstr, $errfile, $errline ) { $args = func_get_args(); print_r($args); return true; } function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr); } ++$lorem; set_error_handler('f'); ++$dolor; set_error_handler(function ($errno, $errstr, $errfile, $errline) { $args = func_get_args(); print_r($args); return true; }); ++$foo; set_error_handler("exception_error_handler"); try { preg_match("/foo(+/", null); echo "+valid\n"; } catch (ErrorException $e) { echo "-fail: ", $e->getMessage(), "\n"; } restore_error_handler(); ++$bar; restore_error_handler(); ++$ipsum; restore_error_handler(); ++$dolor;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 19
Branch analysis from position: 19
2 jumps found. (Code = 107) Position 1 = 20, Position 2 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8njC
function name:  (null)
number of ops:  35
compiled vars:  !0 = $lorem, !1 = $dolor, !2 = $foo, !3 = $e, !4 = $bar, !5 = $ipsum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   PRE_INC                                                  !0
   14     1        INIT_FCALL                                               'set_error_handler'
          2        SEND_VAL                                                 'f'
          3        DO_ICALL                                                 
   16     4        PRE_INC                                                  !1
   18     5        INIT_FCALL                                               'set_error_handler'
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fu8njC%3A18%240'
   22     7        SEND_VAL                                                 ~9
          8        DO_ICALL                                                 
   24     9        PRE_INC                                                  !2
   26    10        INIT_FCALL                                               'set_error_handler'
         11        SEND_VAL                                                 'exception_error_handler'
         12        DO_ICALL                                                 
   28    13        INIT_FCALL                                               'preg_match'
         14        SEND_VAL                                                 '%2Ffoo%28%2B%2F'
         15        SEND_VAL                                                 null
         16        DO_ICALL                                                 
   29    17        ECHO                                                     '%2Bvalid%0A'
         18      > JMP                                                      ->25
   31    19  E > > CATCH                                       last         'ErrorException'
   32    20    >   ECHO                                                     '-fail%3A+'
         21        INIT_METHOD_CALL                                         !3, 'getMessage'
         22        DO_FCALL                                      0  $14     
         23        ECHO                                                     $14
         24        ECHO                                                     '%0A'
   34    25    >   INIT_FCALL                                               'restore_error_handler'
         26        DO_ICALL                                                 
   36    27        PRE_INC                                                  !4
   38    28        INIT_FCALL                                               'restore_error_handler'
         29        DO_ICALL                                                 
   40    30        PRE_INC                                                  !5
   42    31        INIT_FCALL                                               'restore_error_handler'
         32        DO_ICALL                                                 
   44    33        PRE_INC                                                  !1
         34      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8njC
function name:  f
number of ops:  11
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline, !4 = $args
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        FUNC_GET_ARGS                                    ~5      
          5        ASSIGN                                                   !4, ~5
    4     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !4
          8        DO_ICALL                                                 
    5     9      > RETURN                                                   <true>
    6    10*     > RETURN                                                   null

End of function f

Function exception_error_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/u8njC
function name:  exception_error_handler
number of ops:  9
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    9     4        NEW                                              $4      'ErrorException'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $4
   10     8*     > RETURN                                                   null

End of function exception_error_handler

Function %00%7Bclosure%7D%2Fin%2Fu8njC%3A18%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8njC
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline, !4 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   19     4        FUNC_GET_ARGS                                    ~5      
          5        ASSIGN                                                   !4, ~5
   20     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !4
          8        DO_ICALL                                                 
   21     9      > RETURN                                                   <true>
   22    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fu8njC%3A18%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.09 ms | 1400 KiB | 21 Q