3v4l.org

run code in 500+ PHP versions simultaneously
<?php class U { public private(set) string $name = "orig"; } $u = new U; foreach ($u as &$v) { $v = "X"; } // no error, $u->name is now "X" var_dump($u->name); $r = &$u->name; // Error: Cannot indirectly modify private(set) property
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/oL4rA
function name:  (null)
number of ops:  15
compiled vars:  !0 = $u, !1 = $v, !2 = $r
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   NEW                                                  $3      'U'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
    5     3      > FE_RESET_RW                                          $6      !0, ->7
          4    > > FE_FETCH_RW                                                  $6, !1, ->7
          5    >   ASSIGN                                                       !1, 'X'
          6      > JMP                                                          ->4
          7    >   FE_FREE                                                      $6
    6     8        INIT_FCALL                                                   'var_dump'
          9        FETCH_OBJ_R                                          ~8      !0, 'name'
         10        SEND_VAL                                                     ~8
         11        DO_ICALL                                                     
    7    12        FETCH_OBJ_W                                          $10     !0, 'name'
         13        ASSIGN_REF                                                   !2, $10
         14      > RETURN                                                       1

Class U: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.75 ms | 478 KiB | 8 Q