3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait A { public function a() { return 1; } } trait B { use A; public function b() { return 2; } } class C { use B { B::a as real_a; } public function a() { return $this->real_a() + 3; } } $c = new C; echo $c->a();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XthvW
function name:  (null)
number of ops:  9
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'b'
   15     1        DECLARE_CLASS                                            'c'
   23     2        NEW                                              $1      'C'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   24     5        INIT_METHOD_CALL                                         !0, 'a'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Class A:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XthvW
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   1
    5     1*     > RETURN                                                   null

End of function a

End of class A.

Class B:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XthvW
function name:  b
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   2
   12     1*     > RETURN                                                   null

End of function b

End of class B.

Class C:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XthvW
function name:  a
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_METHOD_CALL                                         'real_a'
          1        DO_FCALL                                      0  $0      
          2        ADD                                              ~1      $0, 3
          3      > RETURN                                                   ~1
   21     4*     > RETURN                                                   null

End of function a

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.66 ms | 1394 KiB | 13 Q