3v4l.org

run code in 500+ PHP versions simultaneously
<?php if (!function_exists('get_error_handler')) { function noop_error_handler() { } function get_error_handler(): ?callable { $handler = set_error_handler('noop_error_handler'); restore_error_handler(); return $handler; } } $handler = function (int $errno, string $errstr, ?string $errfile, ?int $errline) { echo "Error: " . $errstr . "\n"; }; set_error_handler($handler); $ab = (fn() => get_error_handler())(); set_error_handler(function() use ($ab) { var_dump($ab); print 123;} ); echo $a;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/DR1qV
function name:  (null)
number of ops:  23
compiled vars:  !0 = $handler, !1 = $ab, !2 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'function_exists'
          1        SEND_VAL                                                     'get_error_handler'
          2        DO_ICALL                                             $3      
          3        BOOL_NOT                                             ~4      $3
          4      > JMPZ                                                         ~4, ->7
    4     5    >   DECLARE_FUNCTION                                             'noop_error_handler'
    6     6        DECLARE_FUNCTION                                             'get_error_handler'
   13     7    >   DECLARE_LAMBDA_FUNCTION                              ~5      [2]
          8        ASSIGN                                                       !0, ~5
   19     9        INIT_FCALL                                                   'set_error_handler'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                                     
   22    12        DECLARE_LAMBDA_FUNCTION                              ~8      [3]
         13        INIT_DYNAMIC_CALL                                            ~8
         14        DO_FCALL                                          0  $9      
         15        ASSIGN                                                       !1, $9
   23    16        INIT_FCALL                                                   'set_error_handler'
         17        DECLARE_LAMBDA_FUNCTION                              ~11     [4]
         18        BIND_LEXICAL                                                 ~11, !1
   29    19        SEND_VAL                                                     ~11
   23    20        DO_ICALL                                                     
   32    21        ECHO                                                         !2
   33    22      > 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/DR1qV
function name:  noop_error_handler
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR1qV
function name:  get_error_handler
number of ops:  10
compiled vars:  !0 = $handler
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                                   'set_error_handler'
          1        SEND_VAL                                                     'noop_error_handler'
          2        DO_ICALL                                             $1      
          3        ASSIGN                                                       !0, $1
    8     4        INIT_FCALL                                                   'restore_error_handler'
          5        DO_ICALL                                                     
    9     6        VERIFY_RETURN_TYPE                                           !0
          7      > RETURN                                                       !0
   10     8*       VERIFY_RETURN_TYPE                                           
          9*     > 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/DR1qV
function name:  {closure:/in/DR1qV:13}
number of ops:  8
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
   14     4        CONCAT                                               ~4      'Error%3A+', !1
          5        CONCAT                                               ~5      ~4, '%0A'
          6        ECHO                                                         ~5
   15     7      > 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/DR1qV
function name:  {closure:/in/DR1qV:22}
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                                   'get_error_handler'
          1        DO_ICALL                                             $0      
          2      > RETURN                                                       $0
          3*     > RETURN                                                       null

End of Dynamic Function 3

Dynamic Function 4
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR1qV
function name:  {closure:/in/DR1qV:23}
number of ops:  6
compiled vars:  !0 = $ab
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   BIND_STATIC                                                  !0
   27     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
   29     4        ECHO                                                         123
          5      > RETURN                                                       null

End of Dynamic Function 4

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.51 ms | 3412 KiB | 18 Q