3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $state = 1; } class B { public $a; public function __construct() { $this->a = $GLOBALS['a']; } } $GLOBALS['a'] = new A(); $b = new B(); echo $b->a->state . PHP_EOL; $GLOBALS['a']->state++; echo $b->a->state . PHP_EOL; $GLOBALS['a'] = new A(); echo $b->a->state . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eTaI5
function name:  (null)
number of ops:  26
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        FETCH_W                      global              $1      'a'
          3        ASSIGN                                                   $1, $2
   17     4        NEW                                              $5      'B'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $5
   18     7        FETCH_OBJ_R                                      ~8      !0, 'a'
          8        FETCH_OBJ_R                                      ~9      ~8, 'state'
          9        CONCAT                                           ~10     ~9, '%0A'
         10        ECHO                                                     ~10
   20    11        FETCH_RW                     global              $11     'a'
         12        PRE_INC_OBJ                                              $11, 'state'
   21    13        FETCH_OBJ_R                                      ~13     !0, 'a'
         14        FETCH_OBJ_R                                      ~14     ~13, 'state'
         15        CONCAT                                           ~15     ~14, '%0A'
         16        ECHO                                                     ~15
   23    17        NEW                                              $17     'A'
         18        DO_FCALL                                      0          
         19        FETCH_W                      global              $16     'a'
         20        ASSIGN                                                   $16, $17
   24    21        FETCH_OBJ_R                                      ~20     !0, 'a'
         22        FETCH_OBJ_R                                      ~21     ~20, 'state'
         23        CONCAT                                           ~22     ~21, '%0A'
         24        ECHO                                                     ~22
         25      > RETURN                                                   1

Class A: [no user functions]
Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eTaI5
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_R                      global              ~1      'a'
          1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  ~1
   12     3      > RETURN                                                   null

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.35 ms | 1449 KiB | 13 Q