3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __construct( public string &$ref { get => $this->ref ?? 'null'; set => $this->ref = $value; } ) {} } $var = 'hello'; $foo = new Foo($var); $var = "world"; echo $foo->ref;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JRArK
function name:  (null)
number of ops:  9
compiled vars:  !0 = $var, !1 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                       !0, 'hello'
   10     1        NEW                                                  $3      'Foo'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !1, $3
   11     5        ASSIGN                                                       !0, 'world'
   13     6        FETCH_OBJ_R                                          ~7      !1, 'ref'
          7        ECHO                                                         ~7
   14     8      > RETURN                                                       1

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

End of function __construct

End of class Foo.

Property ref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JRArK
function name:  $ref::get
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_IS                                         ~0      'ref'
          1        COALESCE                                             ~1      ~0
          2        QM_ASSIGN                                            ~1      'null'
          3        VERIFY_RETURN_TYPE                                           ~1
          4      > RETURN                                                       ~1
          5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of property ref:

Property ref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JRArK
function name:  $ref::set
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
          0  E >   RECV                                                 !0      
          1        ASSIGN_OBJ                                           ~2      'ref'
          2        OP_DATA                                                      !0
          3        ASSIGN_OBJ                                                   'ref'
          4        OP_DATA                                                      ~2
          5      > RETURN                                                       null

End of property ref:

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.25 ms | 1378 KiB | 13 Q