3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function getFoo() { return "FOO!"; } } class Bar { protected function getClass() { return 'Foo'; } } $a = new Bar(); $b = new $a->getClass(); var_dump($b->getFoo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qkvX5
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   17     3        FETCH_OBJ_R                                      ~5      !0, 'getClass'
          4        FETCH_CLASS                                   0  $6      ~5
          5        NEW                                              $7      $6
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   19     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !1, 'getFoo'
         10        DO_FCALL                                      0  $10     
         11        SEND_VAR                                                 $10
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Foo:
Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qkvX5
function name:  getFoo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'FOO%21'
    6     1*     > RETURN                                                   null

End of function getfoo

End of class Foo.

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

End of function getclass

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.1 ms | 1395 KiB | 15 Q