3v4l.org

run code in 300+ 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
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        ASSIGN_OBJ                                               'id'
          3        OP_DATA                                                  !0
          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.0.0


preferences:
178.3 ms | 1001 KiB | 14 Q