3v4l.org

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

Class x:
Function retref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/MAp3d
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:
157.64 ms | 1394 KiB | 15 Q