3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $bar; public function __construct(Bar $bar) { $this->bar = $bar; } public function __get($key) { $exploded = explode('.', $key); $item = $this; do { $next = array_shift($exploded); if (!property_exists($item, $next)) { return null; } $item = $item->{$next}; } while ($exploded); return $item; } } class Bar { public $foobar = 'test'; } $foo = new Foo(new Bar); var_dump($foo->{"bar.foobar"});
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WpL0U
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   NEW                                              $1      'Foo'
          1        NEW                                              $2      'Bar'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   42     6        INIT_FCALL                                               'var_dump'
          7        FETCH_OBJ_R                                      ~6      !0, 'bar.foobar'
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WpL0U
function name:  __construct
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 8
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/WpL0U
function name:  __get
number of ops:  24
compiled vars:  !0 = $key, !1 = $exploded, !2 = $item, !3 = $next
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   16     6        FETCH_THIS                                       ~6      
          7        ASSIGN                                                   !2, ~6
   19     8    >   INIT_FCALL                                               'array_shift'
          9        SEND_REF                                                 !1
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !3, $8
   21    12        INIT_FCALL                                               'property_exists'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $10     
         16        BOOL_NOT                                         ~11     $10
         17      > JMPZ                                                     ~11, ->19
   22    18    > > RETURN                                                   null
   25    19    >   FETCH_OBJ_R                                      ~12     !2, !3
         20        ASSIGN                                                   !2, ~12
   26    21      > JMPNZ                                                    !1, ->8
   28    22    > > RETURN                                                   !2
   29    23*     > RETURN                                                   null

End of function __get

End of class Foo.

Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.07 ms | 1400 KiB | 21 Q