3v4l.org

run code in 500+ PHP versions simultaneously
<?php class User {} function handle(User ...$userList) { print count($userList)." users\n"; /** ... */ } $bunchOfUsers = [ new User(), new User(), ]; echo handle(...$bunchOfUsers); $bunchOfUsers[] = 1; echo handle(...$bunchOfUsers); // error!$bunchOfUsers
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ov9mJ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $bunchOfUsers
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   NEW                                                  $1      'User'
          1        DO_FCALL                                          0          
          2        INIT_ARRAY                                           ~3      $1
   12     3        NEW                                                  $4      'User'
          4        DO_FCALL                                          0          
          5        ADD_ARRAY_ELEMENT                                    ~3      $4
   10     6        ASSIGN                                                       !0, ~3
   15     7        INIT_FCALL                                                   'handle'
          8        SEND_UNPACK                                                  !0
          9        CHECK_UNDEF_ARGS                                             
         10        DO_FCALL                                          1  $7      
         11        ECHO                                                         $7
   17    12        ASSIGN_DIM                                                   !0
         13        OP_DATA                                                      1
   18    14        INIT_FCALL                                                   'handle'
         15        SEND_UNPACK                                                  !0
         16        CHECK_UNDEF_ARGS                                             
         17        DO_FCALL                                          1  $9      
         18        ECHO                                                         $9
         19      > RETURN                                                       1

Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ov9mJ
function name:  handle
number of ops:  5
compiled vars:  !0 = $userList
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV_VARIADIC                                        !0      
    6     1        COUNT                                                ~1      !0
          2        CONCAT                                               ~2      ~1, '+users%0A'
          3        ECHO                                                         ~2
    8     4      > RETURN                                                       null

End of function handle

Class User: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.42 ms | 1499 KiB | 15 Q