3v4l.org

run code in 500+ PHP versions simultaneously
<?php class B { protected $c = 1; } class C1 extends B { function f(B $x) { return $x->c; } } class C2 extends B { protected $c = 2; } var_dump((new C1)->f(new C2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/br0tj
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                                   'var_dump'
          1        NEW                                                  $0      'C1'
          2        DO_FCALL                                          0          
          3        INIT_METHOD_CALL                                             $0, 'f'
          4        NEW                                                  $2      'C2'
          5        DO_FCALL                                          0          
          6        SEND_VAR_NO_REF_EX                                           $2
          7        DO_FCALL                                          0  $4      
          8        SEND_VAR                                                     $4
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

Class B: [no user functions]
Class C1:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/br0tj
function name:  f
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
    9     1        FETCH_OBJ_R                                          ~1      !0, 'c'
          2      > RETURN                                                       ~1
   10     3*     > RETURN                                                       null

End of function f

End of class C1.

Class C2: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.65 ms | 1521 KiB | 14 Q