3v4l.org

run code in 300+ PHP versions simultaneously
<?php class cls { protected $m_str = ''; function __construct( string & $str ) { $this->m_str = & $str; $this->m_str = 'first change'; $this->method( ); } protected function method( ) { $this->m_str = 'second change'; } } $str = 'unchanged'; $obj = new cls( $str ); echo "<br> str = $str";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GpcS2
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 'unchanged'
   20     1        NEW                                              $3      'cls'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   22     5        NOP                                                      
          6        FAST_CONCAT                                      ~6      '%3Cbr%3E+str+%3D+', !0
          7        ECHO                                                     ~6
          8      > RETURN                                                   1

Class cls:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GpcS2
function name:  __construct
number of ops:  8
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ_REF                                           'm_str'
          2        OP_DATA                                                  !0
    9     3        ASSIGN_OBJ                                               'm_str'
          4        OP_DATA                                                  'first+change'
   10     5        INIT_METHOD_CALL                                         'method'
          6        DO_FCALL                                      0          
   11     7      > RETURN                                                   null

End of function __construct

Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GpcS2
function name:  method
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN_OBJ                                               'm_str'
          1        OP_DATA                                                  'second+change'
   15     2      > RETURN                                                   null

End of function method

End of class cls.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.62 ms | 1385 KiB | 13 Q