3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @method &foo() */ class Test { public $values = []; public function &__call($name, $args) { $this->values[$name] ??= null; return $this->values[$name]; } } $test = new Test(); $foo =& $test->foo(); $foo = 42; var_dump($test->values);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CXuLL
function name:  (null)
number of ops:  12
compiled vars:  !0 = $test, !1 = $foo
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, 'foo'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN_REF                                               !1, $5
   18     6        ASSIGN                                                   !1, 42
   20     7        INIT_FCALL                                               'var_dump'
          8        FETCH_OBJ_R                                      ~8      !0, 'values'
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Test:
Function __call:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/CXuLL
function name:  __call
number of ops:  14
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        FETCH_OBJ_IS                                     ~2      'values'
          3        FETCH_DIM_IS                                     ~3      ~2, !0
          4        COALESCE                                         ~4      ~3
          5        FETCH_OBJ_W                                      $5      'values'
          6        ASSIGN_DIM                                       ~6      $5, !0
          7        OP_DATA                                                  null
          8        QM_ASSIGN                                        ~4      ~6
          9        FREE                                                     ~4
   12    10        FETCH_OBJ_W                                      $7      'values'
         11        FETCH_DIM_W                                      $8      $7, !0
         12      > RETURN_BY_REF                                            $8
   13    13*     > RETURN_BY_REF                                            null

End of function __call

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
248.31 ms | 1005 KiB | 14 Q