3v4l.org

run code in 300+ PHP versions simultaneously
<?php class reftest { public $a = 1; public $c = 1; public function reftest() { $b =& $this->a; $b++; } public function reftest2() { $d =& $this->c; $d++; } } $reference = new reftest(); $reference->reftest(); $reference->reftest2(); echo $reference->a; //Echoes 3. echo $reference->c; //Echoes 2.
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PEt3C
function name:  (null)
number of ops:  12
compiled vars:  !0 = $reference
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'reftest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'reftest'
          4        DO_FCALL                                      0          
   23     5        INIT_METHOD_CALL                                         !0, 'reftest2'
          6        DO_FCALL                                      0          
   25     7        FETCH_OBJ_R                                      ~6      !0, 'a'
          8        ECHO                                                     ~6
   26     9        FETCH_OBJ_R                                      ~7      !0, 'c'
         10        ECHO                                                     ~7
         11      > RETURN                                                   1

Class reftest:
Function reftest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PEt3C
function name:  reftest
number of ops:  4
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_W                                      $1      'a'
          1        ASSIGN_REF                                               !0, $1
   10     2        PRE_INC                                                  !0
   11     3      > RETURN                                                   null

End of function reftest

Function reftest2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PEt3C
function name:  reftest2
number of ops:  4
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_W                                      $1      'c'
          1        ASSIGN_REF                                               !0, $1
   16     2        PRE_INC                                                  !0
   17     3      > RETURN                                                   null

End of function reftest2

End of class reftest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.7 ms | 1394 KiB | 13 Q