3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $value = 42; public function &getValue() { return $this->value; } } $obj = new foo; $myValue = &$obj->getValue(); echo $myValue.PHP_EOL; echo $obj->value.PHP_EOL; $obj->value = 2; echo $this->getValue();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rcrBK
function name:  (null)
number of ops:  18
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
   13     6        CONCAT                                           ~7      !1, '%0A'
          7        ECHO                                                     ~7
   14     8        FETCH_OBJ_R                                      ~8      !0, 'value'
          9        CONCAT                                           ~9      ~8, '%0A'
         10        ECHO                                                     ~9
   15    11        ASSIGN_OBJ                                               !0, 'value'
         12        OP_DATA                                                  2
   16    13        FETCH_THIS                                       $11     
         14        INIT_METHOD_CALL                                         $11, 'getValue'
         15        DO_FCALL                                      0  $12     
         16        ECHO                                                     $12
         17      > RETURN                                                   1

Class foo:
Function getvalue:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/rcrBK
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:
162.63 ms | 1394 KiB | 13 Q