3v4l.org

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

Class x:
Function retref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/CeXIp
function name:  retRef
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_W                                      $0      'foo'
          1      > RETURN_BY_REF                                            $0
    7     2*     > RETURN_BY_REF                                            null

End of function retref

End of class x.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.03 ms | 1395 KiB | 15 Q