3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $value = []; public function &getValue() { return $this->value; } } $obj = new foo; $myValue = &$obj->getValue(); // $myValue is a reference to $obj->value, which is 42. $myValue[] = 123; var_dump($obj->value);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3Cjm6
function name:  (null)
number of ops:  13
compiled vars:  !0 = $obj, !1 = $myValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        INIT_METHOD_CALL                                         !0, 'getValue'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN_REF                                               !1, $5
   14     6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  123
   16     8        INIT_FCALL                                               'var_dump'
          9        FETCH_OBJ_R                                      ~8      !0, 'value'
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

End of function getvalue

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.73 ms | 1395 KiB | 15 Q