3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClassA { public function foo(){ echo get_class($this); } } class ClassB extends ClassA { public function foo(){ echo get_class($this); // prints ClassB parent::foo(); // prints ClassB also } } $B = new ClassB(); $B->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pMm5W
function name:  (null)
number of ops:  6
compiled vars:  !0 = $B
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'ClassB'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class ClassA:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pMm5W
function name:  foo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        ECHO                                                     ~1
    7     3      > RETURN                                                   null

End of function foo

End of class ClassA.

Class ClassB:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pMm5W
function name:  foo
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        ECHO                                                     ~1
   14     3        INIT_STATIC_METHOD_CALL                                  'foo'
          4        DO_FCALL                                      0          
   15     5      > RETURN                                                   null

End of function foo

End of class ClassB.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.92 ms | 1385 KiB | 13 Q