3v4l.org

run code in 500+ PHP versions simultaneously
<?php spl_autoload_register(function($class) { if ($class === 'A') { class A { public function foo($x): B { return new B; } } } else if ($class === 'B') { class B extends A { public function foo($x): C { return new C; } } var_dump(new B); } else if ($class === 'C') { class C extends B implements N { } } }); new C;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oUoG2
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'spl_autoload_register'
          1        DECLARE_LAMBDA_FUNCTION                              ~0      [0]
   21     2        SEND_VAL                                                     ~0
    3     3        DO_ICALL                                                     
   23     4        NEW                                                  $2      'C'
          5        DO_FCALL                                          0          
          6        FREE                                                         $2
   24     7      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/oUoG2
function name:  {closure:/in/oUoG2:3}
number of ops:  18
compiled vars:  !0 = $class
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        IS_IDENTICAL                                                 !0, 'A'
          2      > JMPZ                                                         ~1, ->5
    5     3    >   DECLARE_CLASS                                                'a'
    4     4      > JMP                                                          ->17
   10     5    >   IS_IDENTICAL                                                 !0, 'B'
          6      > JMPZ                                                         ~2, ->14
   11     7    >   DECLARE_CLASS                                                'b', 'a'
   16     8        INIT_FCALL                                                   'var_dump'
          9        NEW                                                  $3      'B'
         10        DO_FCALL                                          0          
         11        SEND_VAR                                                     $3
         12        DO_ICALL                                                     
   10    13      > JMP                                                          ->17
   17    14    >   IS_IDENTICAL                                                 !0, 'C'
         15      > JMPZ                                                         ~6, ->17
   18    16    >   DECLARE_CLASS                                                'c', 'b'
   21    17    > > RETURN                                                       null

End of Dynamic Function 0

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oUoG2
function name:  foo
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        NEW                                                  $1      'B'
          2        DO_FCALL                                          0          
          3        VERIFY_RETURN_TYPE                                           $1
          4      > RETURN                                                       $1
    8     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function foo

End of class A.

Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oUoG2
function name:  foo
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   13     1        NEW                                                  $1      'C'
          2        DO_FCALL                                          0          
          3        VERIFY_RETURN_TYPE                                           $1
          4      > RETURN                                                       $1
   14     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function foo

End of class B.

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
149.03 ms | 1581 KiB | 10 Q