3v4l.org

run code in 500+ PHP versions simultaneously
<?php /** * @property stdClass $x * @property stdClass $y */ class C { private $buffer = array(); function __get($key) { if (array_key_exists($key, $this->buffer)) { return $this->buffer[$key]; } $f = 'calc_' . $key; return $this->buffer[$key] = $this->$f(); } function calc_x() { $x = new stdClass; $x->y = $this->y; return $x; } function calc_y() { $y = new stdClass; // Set a stub to avoid infinite recursion. $this->buffer['y'] = $y; $y->x = $this->x; return $y; } } $c = new C; $c->x; $c = new C; $c->y;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00Kuv
function name:  (null)
number of ops:  11
compiled vars:  !0 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   33     0  E >   NEW                                                  $1      'C'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   34     3        FETCH_OBJ_R                                          ~4      !0, 'x'
          4        FREE                                                         ~4
   35     5        NEW                                                  $5      'C'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $5
   36     8        FETCH_OBJ_R                                          ~8      !0, 'y'
          9        FREE                                                         ~8
         10      > RETURN                                                       1

Class C:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00Kuv
function name:  __get
number of ops:  16
compiled vars:  !0 = $key, !1 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   11     1        FETCH_OBJ_R                                          ~2      'buffer'
          2        ARRAY_KEY_EXISTS                                             !0, ~2
          3      > JMPZ                                                         ~3, ->7
   12     4    >   FETCH_OBJ_R                                          ~4      'buffer'
          5        FETCH_DIM_R                                          ~5      ~4, !0
          6      > RETURN                                                       ~5
   14     7    >   CONCAT                                               ~6      'calc_', !0
          8        ASSIGN                                                       !1, ~6
   15     9        INIT_METHOD_CALL                                             !1
         10        DO_FCALL                                          0  $10     
         11        FETCH_OBJ_W                                          $8      'buffer'
         12        ASSIGN_DIM                                           ~9      $8, !0
         13        OP_DATA                                                      $10
         14      > RETURN                                                       ~9
   16    15*     > RETURN                                                       null

End of function __get

Function calc_x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00Kuv
function name:  calc_x
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $1      'stdClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   20     3        FETCH_OBJ_R                                          ~5      'y'
          4        ASSIGN_OBJ                                                   !0, 'y'
          5        OP_DATA                                                      ~5
   21     6      > RETURN                                                       !0
   22     7*     > RETURN                                                       null

End of function calc_x

Function calc_y:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/00Kuv
function name:  calc_y
number of ops:  11
compiled vars:  !0 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   NEW                                                  $1      'stdClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   27     3        FETCH_OBJ_W                                          $4      'buffer'
          4        ASSIGN_DIM                                                   $4, 'y'
          5        OP_DATA                                                      !0
   28     6        FETCH_OBJ_R                                          ~7      'x'
          7        ASSIGN_OBJ                                                   !0, 'x'
          8        OP_DATA                                                      ~7
   29     9      > RETURN                                                       !0
   30    10*     > RETURN                                                       null

End of function calc_y

End of class C.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.22 ms | 2590 KiB | 13 Q