3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo{ protected function bar(){ echo 'Foo', PHP_EOL; var_dump($this); return $this; } } class Bar extends Foo{ public function foo(){ echo 'Bar', PHP_EOL; 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/b73bt
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/b73bt
function name:  bar
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'Foo'
          1        ECHO                                                     '%0A'
    6     2        INIT_FCALL                                               'var_dump'
          3        FETCH_THIS                                       ~0      
          4        SEND_VAL                                                 ~0
          5        DO_ICALL                                                 
    7     6        FETCH_THIS                                       ~2      
          7      > RETURN                                                   ~2
    8     8*     > 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/b73bt
function name:  foo
number of ops:  13
compiled vars:  !0 = $barClassInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'Bar'
          1        ECHO                                                     '%0A'
   14     2        INIT_FCALL                                               'var_dump'
          3        FETCH_THIS                                       ~1      
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
   16     6        INIT_METHOD_CALL                                         'bar'
          7        DO_FCALL                                      0  $3      
          8        ASSIGN                                                   !0, $3
   17     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   18    12      > 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/b73bt
function name:  bar
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'Foo'
          1        ECHO                                                     '%0A'
    6     2        INIT_FCALL                                               'var_dump'
          3        FETCH_THIS                                       ~0      
          4        SEND_VAL                                                 ~0
          5        DO_ICALL                                                 
    7     6        FETCH_THIS                                       ~2      
          7      > RETURN                                                   ~2
    8     8*     > RETURN                                                   null

End of function bar

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.33 ms | 1400 KiB | 15 Q