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); set_error_handler(function() { $a = get_error_handler(); $a(); 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/3qZKm
function name:  (null)
number of ops:  18
compiled vars:  !0 = $handler, !1 = $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                                             $2      
          3        BOOL_NOT                                             ~3      $2
          4      > JMPZ                                                         ~3, ->7
    4     5    >   DECLARE_FUNCTION                                             'noop_error_handler'
    6     6        DECLARE_FUNCTION                                             'get_error_handler'
   13     7    >   DECLARE_LAMBDA_FUNCTION                              ~4      [2]
          8        ASSIGN                                                       !0, ~4
   19     9        INIT_FCALL                                                   'set_error_handler'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                                     
   21    12        INIT_FCALL                                                   'set_error_handler'
         13        DECLARE_LAMBDA_FUNCTION                              ~7      [3]
   24    14        SEND_VAL                                                     ~7
   21    15        DO_ICALL                                                     
   27    16        ECHO                                                         !1
   28    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/3qZKm
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/3qZKm
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/3qZKm
function name:  {closure:/in/3qZKm: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/3qZKm
function name:  {closure:/in/3qZKm:21}
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                                   'get_error_handler'
          1        DO_ICALL                                             $1      
          2        ASSIGN                                                       !0, $1
   23     3        INIT_DYNAMIC_CALL                                            !0
          4        DO_FCALL                                          0          
   24     5        ECHO                                                         123
          6      > RETURN                                                       null

End of Dynamic Function 3

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
206.53 ms | 3425 KiB | 17 Q