3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $a = 1; public function &getA() { return [ &$this->a ];; } } $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/eFjfI
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   16     3        INIT_METHOD_CALL                                         !0, 'getA'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN_REF                                               !1, $5
   18     6        ASSIGN_OBJ                                               !0, 'a'
          7        OP_DATA                                                  2
   20     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/eFjfI
function name:  getA
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_W                                      $0      'a'
          1        INIT_ARRAY                                       ~1      $0
          2      > RETURN_BY_REF                                            ~1
   12     3*     > RETURN_BY_REF                                            null

End of function geta

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.13 ms | 1386 KiB | 15 Q