3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $bar = ''; public function setDefaultBar() { $this->bar = get_class_vars(get_class($this))['bar']; } } $foo = new foo(); $foo->bar = 'foobar'; $bar = new foo(); $bar->bar = 'foobar'; $foo->setDefaultBar(); var_dump($foo->bar, $bar->bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u2BDB
function name:  (null)
number of ops:  19
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   13     3        ASSIGN_OBJ                                               !0, 'bar'
          4        OP_DATA                                                  'foobar'
   15     5        NEW                                              $6      'foo'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   16     8        ASSIGN_OBJ                                               !1, 'bar'
          9        OP_DATA                                                  'foobar'
   17    10        INIT_METHOD_CALL                                         !0, 'setDefaultBar'
         11        DO_FCALL                                      0          
   19    12        INIT_FCALL                                               'var_dump'
         13        FETCH_OBJ_R                                      ~11     !0, 'bar'
         14        SEND_VAL                                                 ~11
         15        FETCH_OBJ_R                                      ~12     !1, 'bar'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class foo:
Function setdefaultbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u2BDB
function name:  setDefaultBar
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'get_class_vars'
          1        FETCH_THIS                                       ~1      
          2        GET_CLASS                                        ~2      ~1
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                         $3      
          5        FETCH_DIM_R                                      ~4      $3, 'bar'
          6        ASSIGN_OBJ                                               'bar'
          7        OP_DATA                                                  ~4
    9     8      > RETURN                                                   null

End of function setdefaultbar

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.05 ms | 1396 KiB | 17 Q