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; } } } else if ($class === 'C') { class C extends B { } } }); (new C)->foo('blah');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AhD6U
function name:  (null)
number of ops:  10
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]
   20     2        SEND_VAL                                                     ~0
    3     3        DO_ICALL                                                     
   22     4        NEW                                                  $2      'C'
          5        DO_FCALL                                          0          
          6        INIT_METHOD_CALL                                             $2, 'foo'
          7        SEND_VAL_EX                                                  'blah'
          8        DO_FCALL                                          0          
          9      > 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 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/AhD6U
function name:  {closure:/in/AhD6U:3}
number of ops:  13
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                                                          ->12
   10     5    >   IS_IDENTICAL                                                 !0, 'B'
          6      > JMPZ                                                         ~2, ->9
   11     7    >   DECLARE_CLASS                                                'b', 'a'
   10     8      > JMP                                                          ->12
   16     9    >   IS_IDENTICAL                                                 !0, 'C'
         10      > JMPZ                                                         ~3, ->12
   17    11    >   DECLARE_CLASS                                                'c', 'b'
   20    12    > > 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/AhD6U
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/AhD6U
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:
151.79 ms | 1482 KiB | 9 Q