3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { protected $_a = 6; function __get($key) { echo "__get({$key})\n"; if($key == 'stuff') { return $this->stuff(); } else if($key == 'a') { return $this->_a; } } function stuff() { echo "stuff()\n"; return array('random' => 'key', 'using_getter' => 10 * $this->a); } } $test = new test(); print 'this should be 60: '.$test->stuff['using_getter'].PHP_EOL; print 'this should be 6: '.$test->a.PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbBH9
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        FETCH_OBJ_R                                      ~4      !0, 'stuff'
          4        FETCH_DIM_R                                      ~5      ~4, 'using_getter'
          5        CONCAT                                           ~6      'this+should+be+60%3A+', ~5
          6        CONCAT                                           ~7      ~6, '%0A'
          7        ECHO                                                     ~7
   25     8        FETCH_OBJ_R                                      ~8      !0, 'a'
          9        CONCAT                                           ~9      'this+should+be+6%3A+', ~8
         10        CONCAT                                           ~10     ~9, '%0A'
         11        ECHO                                                     ~10
         12      > RETURN                                                   1

Class test:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbBH9
function name:  __get
number of ops:  16
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ROPE_INIT                                     3  ~2      '__get%28'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%29%0A'
          4        ECHO                                                     ~1
    9     5        IS_EQUAL                                                 !0, 'stuff'
          6      > JMPZ                                                     ~4, ->11
   10     7    >   INIT_METHOD_CALL                                         'stuff'
          8        DO_FCALL                                      0  $5      
          9      > RETURN                                                   $5
         10*       JMP                                                      ->15
   11    11    >   IS_EQUAL                                                 !0, 'a'
         12      > JMPZ                                                     ~6, ->15
   12    13    >   FETCH_OBJ_R                                      ~7      '_a'
         14      > RETURN                                                   ~7
   14    15    > > RETURN                                                   null

End of function __get

Function stuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbBH9
function name:  stuff
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ECHO                                                     'stuff%28%29%0A'
   19     1        INIT_ARRAY                                       ~0      'key', 'random'
          2        FETCH_OBJ_R                                      ~1      'a'
          3        MUL                                              ~2      ~1, 10
          4        ADD_ARRAY_ELEMENT                                ~0      ~2, 'using_getter'
          5      > RETURN                                                   ~0
   20     6*     > RETURN                                                   null

End of function stuff

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.54 ms | 1403 KiB | 13 Q