3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { public function __constructor() { $that = & $this; $that = new b(); var_dump('#1 that = '.get_class($that)); } public function change() { $that = & $this; $that = new b(); var_dump('#2 that = '.get_class($that)); var_dump('#2 this = '.get_class($this)); } } class b { } $class = new a(); var_dump(get_class($class)); $class->change(); var_dump(get_class($class));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/06Xcn
function name:  (null)
number of ops:  14
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'a'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   27     3        INIT_FCALL                                               'var_dump'
          4        GET_CLASS                                        ~4      !0
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   28     7        INIT_METHOD_CALL                                         !0, 'change'
          8        DO_FCALL                                      0          
   29     9        INIT_FCALL                                               'var_dump'
         10        GET_CLASS                                        ~7      !0
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class a:
Function __constructor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/06Xcn
function name:  __constructor
number of ops:  11
compiled vars:  !0 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       $1      
          1        ASSIGN_REF                                               !0, $1
    8     2        NEW                                              $3      'b'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
    9     5        INIT_FCALL                                               'var_dump'
          6        GET_CLASS                                        ~6      !0
          7        CONCAT                                           ~7      '%231+that+%3D+', ~6
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                                 
   10    10      > RETURN                                                   null

End of function __constructor

Function change:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/06Xcn
function name:  change
number of ops:  17
compiled vars:  !0 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_THIS                                       $1      
          1        ASSIGN_REF                                               !0, $1
   14     2        NEW                                              $3      'b'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   15     5        INIT_FCALL                                               'var_dump'
          6        GET_CLASS                                        ~6      !0
          7        CONCAT                                           ~7      '%232+that+%3D+', ~6
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                                 
   16    10        INIT_FCALL                                               'var_dump'
         11        FETCH_THIS                                       ~9      
         12        GET_CLASS                                        ~10     ~9
         13        CONCAT                                           ~11     '%232+this+%3D+', ~10
         14        SEND_VAL                                                 ~11
         15        DO_ICALL                                                 
   17    16      > RETURN                                                   null

End of function change

End of class a.

Class b: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.19 ms | 1400 KiB | 15 Q