3v4l.org

run code in 500+ PHP versions simultaneously
<?php # Typed Properties 2.0 # OLD WAY (PHP < 7.4 ) class User { public $id; public $name; public function __construct(int $id, string $name) { $this->id = $id; $this->name = $name; } } $user = new User(10, []); // This Will throw a Fatal error. # Typed Properties with PHP 7.4 All types are supported, with the exception of void and callable. class NewUser { public int $id; public string $name; } $newUser = new NewUser; $newUser->id = 10; $newUser->name = []; // This Will throw a Fatal error too !!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iFsCM
function name:  (null)
number of ops:  13
compiled vars:  !0 = $user, !1 = $newUser
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $2      'User'
          1        SEND_VAL_EX                                                  10
          2        SEND_VAL_EX                                                  <array>
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $2
   23     5        NEW                                                  $5      'NewUser'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $5
   24     8        ASSIGN_OBJ                                                   !1, 'id'
          9        OP_DATA                                                      10
   25    10        ASSIGN_OBJ                                                   !1, 'name'
         11        OP_DATA                                                      <array>
         12      > RETURN                                                       1

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

End of function __construct

End of class User.

Class NewUser: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
235.63 ms | 2157 KiB | 13 Q