3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Base { private $foo; public function setFoo($foo) { $this->foo = $foo; } public function foo() { return $this->foo; } } class Foo extends Base { public function foo() { return ' - '.parent::foo(); } } $obj = new Foo(); $obj2 = new Foo(); $obj->setFoo('yay'); $obj2->setFoo('nay'); var_dump($obj->foo(), $obj2->foo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nu6Uo
function name:  (null)
number of ops:  21
compiled vars:  !0 = $obj, !1 = $obj2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   15     3        NEW                                              $5      'Foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   16     6        INIT_METHOD_CALL                                         !0, 'setFoo'
          7        SEND_VAL_EX                                              'yay'
          8        DO_FCALL                                      0          
   17     9        INIT_METHOD_CALL                                         !1, 'setFoo'
         10        SEND_VAL_EX                                              'nay'
         11        DO_FCALL                                      0          
   18    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'foo'
         14        DO_FCALL                                      0  $10     
         15        SEND_VAR                                                 $10
         16        INIT_METHOD_CALL                                         !1, 'foo'
         17        DO_FCALL                                      0  $11     
         18        SEND_VAR                                                 $11
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class Base:
Function setfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nu6Uo
function name:  setFoo
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function setfoo

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

End of function foo

End of class Base.

Class Foo:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nu6Uo
function name:  foo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'foo'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      '+-+', $0
          3      > RETURN                                                   ~1
          4*     > RETURN                                                   null

End of function foo

Function setfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nu6Uo
function name:  setFoo
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function setfoo

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.57 ms | 1400 KiB | 15 Q