3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $a = 1; public function &getA() { $d = [ &$this->a ]; return $d; } } $a = new Test(); $b = &$a->getA(); $a->a = 2; var_dump($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uHiOD
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   17     3        INIT_METHOD_CALL                                         !0, 'getA'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN_REF                                               !1, $5
   19     6        ASSIGN_OBJ                                               !0, 'a'
          7        OP_DATA                                                  2
   21     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Test:
Function geta:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/uHiOD
function name:  getA
number of ops:  5
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_W                                      $1      'a'
          1        INIT_ARRAY                                       ~2      $1
    8     2        ASSIGN                                                   !0, ~2
   12     3      > RETURN_BY_REF                                            !0
   13     4*     > RETURN_BY_REF                                            null

End of function geta

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.42 ms | 1386 KiB | 15 Q