3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; public function setBar($bar) { $this->bar = $bar; } public function getBar() { return $this->bar; } public function setName($name) { $this->getBar()->name_from_get = 'Baz'; $this->bar->name_directly = 'Baz'; } } $f = new Foo(); $f->setBar(new \stdClass()); $f->setName('Baz'); var_dump($f->getBar());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QniFJ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'setBar'
          4        NEW                                              $4      'stdClass'
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $4
          7        DO_FCALL                                      0          
   28     8        INIT_METHOD_CALL                                         !0, 'setName'
          9        SEND_VAL_EX                                              'Baz'
         10        DO_FCALL                                      0          
   30    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getBar'
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Foo:
Function setbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QniFJ
function name:  setBar
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function setbar

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

End of function getbar

Function setname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QniFJ
function name:  setName
number of ops:  10
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        INIT_METHOD_CALL                                         'getBar'
          2        DO_FCALL                                      0  $1      
          3        SEPARATE                                         $1      $1
          4        ASSIGN_OBJ                                               $1, 'name_from_get'
          5        OP_DATA                                                  'Baz'
   20     6        FETCH_OBJ_W                                      $3      'bar'
          7        ASSIGN_OBJ                                               $3, 'name_directly'
          8        OP_DATA                                                  'Baz'
   21     9      > RETURN                                                   null

End of function setname

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.33 ms | 1400 KiB | 15 Q