3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x extends ArrayObject { // public function offsetGet($key) { static $i = 0; $i++; if ($i == 1) return $this[$key]; else return 'bla';} function __get($key) { static $i = 0; $i++; if ($i == 1) return $this->$key; else return 'bla';} } $x = new x(); //var_dump($x['test']); var_dump($x->test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/luYXf
function name:  (null)
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $1      'x'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'test'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Class x:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/luYXf
function name:  __get
number of ops:  10
compiled vars:  !0 = $key, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        PRE_INC                                                  !1
          3        IS_EQUAL                                                 !1, 1
          4      > JMPZ                                                     ~3, ->8
          5    >   FETCH_OBJ_R                                      ~4      !0
          6      > RETURN                                                   ~4
          7*       JMP                                                      ->9
          8    > > RETURN                                                   'bla'
          9*     > RETURN                                                   null

End of function __get

End of class x.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.36 ms | 1395 KiB | 15 Q