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

End of function __get

End of class Magic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.26 ms | 1395 KiB | 15 Q