3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $references; private $bar; public function __construct() { $this->references = ['bar' => & $this->bar]; unset($this->baz); } public function & __get($name) { if (! isset($this->$name)) { var_dump('initialized'); $this->$name = 'initialized - ' . $name; } return $this->$name; } } $foo = new Foo(); var_dump($foo->references); $foo->references['bar'] = 'bar pre-initialized'; var_dump($foo->bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3hRYt
function name:  (null)
number of ops:  15
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   28     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'references'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   29     7        FETCH_OBJ_W                                      $6      !0, 'references'
          8        ASSIGN_DIM                                               $6, 'bar'
          9        OP_DATA                                                  'bar+pre-initialized'
   30    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~8      !0, 'bar'
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3hRYt
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_W                                      $1      'bar'
          1        INIT_ARRAY                                       ~2      $1, 'bar'
          2        ASSIGN_OBJ                                               'references'
          3        OP_DATA                                                  ~2
   12     4        UNSET_OBJ                                                'baz'
   13     5      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
Return found
Branch analysis from position: 10
filename:       /in/3hRYt
function name:  __get
number of ops:  13
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->10
   18     4    >   INIT_FCALL                                               'var_dump'
          5        SEND_VAL                                                 'initialized'
          6        DO_ICALL                                                 
   19     7        CONCAT                                           ~5      'initialized+-+', !0
          8        ASSIGN_OBJ                                               !0
          9        OP_DATA                                                  ~5
   22    10    >   FETCH_OBJ_W                                      $6      !0
         11      > RETURN_BY_REF                                            $6
   23    12*     > RETURN_BY_REF                                            null

End of function __get

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.69 ms | 1405 KiB | 15 Q