3v4l.org

run code in 500+ PHP versions simultaneously
<?php class User { public string $name { set { if (strlen($value) === 0) { throw new ValueError("Name must be non-empty"); } $field = ucfirst($value); } } public function __construct(string $name) { $this->name = $name; } } $u = new User('roman'); var_dump($u->name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y4KZn
function name:  (null)
number of ops:  9
compiled vars:  !0 = $u
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $1      'User'
          1        SEND_VAL_EX                                                  'roman'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   20     4        INIT_FCALL                                                   'var_dump'
          5        FETCH_OBJ_R                                          ~4      !0, 'name'
          6        SEND_VAL                                                     ~4
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

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

End of function __construct

End of class User.

Property name:
End of property name:

Property name:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y4KZn
function name:  $name::set
number of ops:  13
compiled vars:  !0 = $value, !1 = $field
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    7     1        STRLEN                                               ~2      !0
          2        IS_IDENTICAL                                                 ~2, 0
          3      > JMPZ                                                         ~3, ->8
    8     4    >   NEW                                                  $4      'ValueError'
          5        SEND_VAL_EX                                                  'Name+must+be+non-empty'
          6        DO_FCALL                                          0          
          7      > THROW                                             0          $4
   10     8    >   INIT_FCALL                                                   'ucfirst'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                             $6      
         11        ASSIGN                                                       !1, $6
   11    12      > RETURN                                                       null

End of property name:

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
196.76 ms | 3053 KiB | 15 Q