3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait A { public function get($name) { return 'poop'; } } class p { public function get($name) { return 'parent'; } } class c extends p { use A { get as getPoop; } } $a = new c(); var_dump($a->get('anything')); var_dump($a->getPoop('anything'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/URAtD
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'c', 'p'
   21     1        NEW                                              $1      'c'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   22     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'get'
          6        SEND_VAL_EX                                              'anything'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   23    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'getPoop'
         12        SEND_VAL_EX                                              'anything'
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

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

End of function get

End of class A.

Class p:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/URAtD
function name:  get
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1      > RETURN                                                   'parent'
   12     2*     > RETURN                                                   null

End of function get

End of class p.

Class c: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.83 ms | 1396 KiB | 15 Q