3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $ref; public function &getRef() { return $this->ref; } public function test() { $this->ref = 123; $local = $this->getRef(); $this->ref = 456; echo $local; } } (new Foo)->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nvqe2
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $0      'Foo'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'test'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class Foo:
Function getref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/Nvqe2
function name:  getRef
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_W                                      $0      'ref'
          1      > RETURN_BY_REF                                            $0
   11     2*     > RETURN_BY_REF                                            null

End of function getref

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nvqe2
function name:  test
number of ops:  9
compiled vars:  !0 = $local
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN_OBJ                                               'ref'
          1        OP_DATA                                                  123
   17     2        INIT_METHOD_CALL                                         'getRef'
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   19     5        ASSIGN_OBJ                                               'ref'
          6        OP_DATA                                                  456
   21     7        ECHO                                                     !0
   22     8      > RETURN                                                   null

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.19 ms | 1385 KiB | 13 Q