3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ancestor { public function foo() { return 'PARENT'; } } class Child extends Ancestor { public function foo() { return 'CHILD'; } } $foo = new Ancestor; $bar = new Child; var_dump($foo->foo()); var_dump($bar->foo()); var_dump(call_user_func([$bar, 'Ancestor::foo']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bPhYP
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'Ancestor'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        NEW                                              $5      'Child'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   14     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'foo'
          8        DO_FCALL                                      0  $8      
          9        SEND_VAR                                                 $8
         10        DO_ICALL                                                 
   15    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !1, 'foo'
         13        DO_FCALL                                      0  $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                                 
   16    16        INIT_FCALL                                               'var_dump'
         17        INIT_ARRAY                                       ~12     !1
         18        ADD_ARRAY_ELEMENT                                ~12     'Ancestor%3A%3Afoo'
         19        INIT_USER_CALL                                0          'call_user_func', ~12
         20        DO_FCALL                                      0  $13     
         21        SEND_VAR                                                 $13
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

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

End of function foo

End of class Ancestor.

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

End of function foo

End of class Child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.72 ms | 1001 KiB | 14 Q