3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public function __construct(public int $id) {} } class Admin { public function __construct(public int $id) {} } /** * @param User[] $users */ function deleteUsers(array $users) { $typedArray = (fn (User ...$users) => $users)(...$users); foreach ($typedArray as $user) { var_dump($user->id); } } deleteUsers([new User(1), new User(2), new User(3)]); deleteUsers([new User(4), new Admin(5), new User(6)]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fjrcM
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'deleteusers'
          1        NEW                                              $0      'User'
          2        SEND_VAL_EX                                              1
          3        DO_FCALL                                      0          
          4        INIT_ARRAY                                       ~2      $0
          5        NEW                                              $3      'User'
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0          
          8        ADD_ARRAY_ELEMENT                                ~2      $3
          9        NEW                                              $5      'User'
         10        SEND_VAL_EX                                              3
         11        DO_FCALL                                      0          
         12        ADD_ARRAY_ELEMENT                                ~2      $5
         13        SEND_VAL                                                 ~2
         14        DO_FCALL                                      0          
   19    15        INIT_FCALL                                               'deleteusers'
         16        NEW                                              $8      'User'
         17        SEND_VAL_EX                                              4
         18        DO_FCALL                                      0          
         19        INIT_ARRAY                                       ~10     $8
         20        NEW                                              $11     'Admin'
         21        SEND_VAL_EX                                              5
         22        DO_FCALL                                      0          
         23        ADD_ARRAY_ELEMENT                                ~10     $11
         24        NEW                                              $13     'User'
         25        SEND_VAL_EX                                              6
         26        DO_FCALL                                      0          
         27        ADD_ARRAY_ELEMENT                                ~10     $13
         28        SEND_VAL                                                 ~10
         29        DO_FCALL                                      0          
         30      > RETURN                                                   1

Function deleteusers:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/fjrcM
function name:  deleteUsers
number of ops:  16
compiled vars:  !0 = $users, !1 = $typedArray, !2 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          2        INIT_DYNAMIC_CALL                                        ~3
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1  $4      
          6        ASSIGN                                                   !1, $4
   13     7      > FE_RESET_R                                       $6      !1, ->14
          8    > > FE_FETCH_R                                               $6, !2, ->14
   14     9    >   INIT_FCALL                                               'var_dump'
         10        FETCH_OBJ_R                                      ~7      !2, 'id'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
   13    13      > JMP                                                      ->8
         14    >   FE_FREE                                                  $6
   16    15      > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fjrcM
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $users
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV_VARIADIC                                    !0      
          1      > RETURN                                                   !0
          2*     > RETURN                                                   null

End of Dynamic Function 0

End of function deleteusers

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

End of function __construct

End of class User.

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

End of function __construct

End of class Admin.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.01 ms | 992 KiB | 16 Q