3v4l.org

run code in 500+ PHP versions simultaneously
<?php readonly class User { public function __construct( public int $id, public string $name ) {} } $user = new User(123, "Rasmus"); var_dump($user->id, $user->name); $user->id = 456; // error: Cannot modify readonly property User::$id
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DiV1A
function name:  (null)
number of ops:  14
compiled vars:  !0 = $user
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   NEW                                                  $1      'User'
          1        SEND_VAL_EX                                                  123
          2        SEND_VAL_EX                                                  'Rasmus'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $1
   12     5        INIT_FCALL                                                   'var_dump'
          6        FETCH_OBJ_R                                          ~4      !0, 'id'
          7        SEND_VAL                                                     ~4
          8        FETCH_OBJ_R                                          ~5      !0, 'name'
          9        SEND_VAL                                                     ~5
         10        DO_ICALL                                                     
   14    11        ASSIGN_OBJ                                                   !0, 'id'
         12        OP_DATA                                                      456
         13      > RETURN                                                       1

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

End of function __construct

End of class User.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.01 ms | 795 KiB | 9 Q