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); var_dump($this->v[$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/5iQWR
function name:  (null)
number of ops:  18
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'Magic'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   12     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'd'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   13     7        FETCH_OBJ_W                                      $6      !0, 'd'
          8        ASSIGN_DIM                                               $6
          9        OP_DATA                                                  4
   14    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~8      !0, 'd'
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                                 
   15    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/5iQWR
function name:  __get
number of ops:  13
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        INIT_FCALL                                               'var_dump'
          5        FETCH_OBJ_R                                      ~2      'v'
          6        FETCH_DIM_R                                      ~3      ~2, !0
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
    8     9        FETCH_OBJ_W                                      $5      'v'
         10        FETCH_DIM_W                                      $6      $5, !0
         11      > RETURN_BY_REF                                            $6
    9    12*     > RETURN_BY_REF                                            null

End of function __get

End of class Magic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.05 ms | 1396 KiB | 15 Q