3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo{ protected function bar(){ echo 'Foo'; var_dump($this); return $this; } } class Bar extends Foo{ public function foo(){ echo 'Bar'; var_dump($this); // this should hold Bar instance and not Foo's $barClassInstance = $this->bar(); var_dump($barClassInstance); } } $bar = new Bar(); $bar->foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uj2H8
function name:  (null)
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uj2H8
function name:  bar
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'Foo'
    6     1        INIT_FCALL                                               'var_dump'
          2        FETCH_THIS                                       ~0      
          3        SEND_VAL                                                 ~0
          4        DO_ICALL                                                 
    7     5        FETCH_THIS                                       ~2      
          6      > RETURN                                                   ~2
    8     7*     > RETURN                                                   null

End of function bar

End of class Foo.

Class Bar:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uj2H8
function name:  foo
number of ops:  12
compiled vars:  !0 = $barClassInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'Bar'
   14     1        INIT_FCALL                                               'var_dump'
          2        FETCH_THIS                                       ~1      
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   16     5        INIT_METHOD_CALL                                         'bar'
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
   17     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   18    11      > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uj2H8
function name:  bar
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'Foo'
    6     1        INIT_FCALL                                               'var_dump'
          2        FETCH_THIS                                       ~0      
          3        SEND_VAL                                                 ~0
          4        DO_ICALL                                                 
    7     5        FETCH_THIS                                       ~2      
          6      > RETURN                                                   ~2
    8     7*     > RETURN                                                   null

End of function bar

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.29 ms | 1400 KiB | 15 Q