3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Magic { protected $v = array("a" => 1, "b" => 2, "c" => 3); public function &__get($v) { var_dump($v); return $this->v[$v]; } } $m = new Magic(); var_dump($m->d); $m->d[] = 4; var_dump($m->d); echo $m->d[0];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/20saO
function name:  (null)
number of ops:  18
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'Magic'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'd'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   12     7        FETCH_OBJ_W                                      $6      !0, 'd'
          8        ASSIGN_DIM                                               $6
          9        OP_DATA                                                  4
   13    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~8      !0, 'd'
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                                 
   14    14        FETCH_OBJ_R                                      ~10     !0, 'd'
         15        FETCH_DIM_R                                      ~11     ~10, 0
         16        ECHO                                                     ~11
         17      > RETURN                                                   1

Class Magic:
Function __get:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/20saO
function name:  __get
number of ops:  8
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    7     4        FETCH_OBJ_W                                      $2      'v'
          5        FETCH_DIM_W                                      $3      $2, !0
          6      > RETURN_BY_REF                                            $3
    8     7*     > RETURN_BY_REF                                            null

End of function __get

End of class Magic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.61 ms | 1395 KiB | 15 Q