3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $prop = 0; public function &getPropRef () { return (int)$this->prop; } } $obj = new Foo(); $variable = &$obj->getPropRef(); $variable = 1; $variable = 2; $variable = 3; echo $obj->prop;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I4KcF
function name:  (null)
number of ops:  12
compiled vars:  !0 = $obj, !1 = $variable
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, 'getPropRef'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN_REF                                               !1, $5
   13     6        ASSIGN                                                   !1, 1
   14     7        ASSIGN                                                   !1, 2
   15     8        ASSIGN                                                   !1, 3
   16     9        FETCH_OBJ_R                                      ~10     !0, 'prop'
         10        ECHO                                                     ~10
   17    11      > RETURN                                                   1

Class Foo:
Function getpropref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/I4KcF
function name:  getPropRef
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'prop'
          1        CAST                                          4  ~1      ~0
          2      > RETURN_BY_REF                                            ~1
    8     3*     > RETURN_BY_REF                                            null

End of function getpropref

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.44 ms | 994 KiB | 13 Q