3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(...$args) { var_dump($args); } test(1, 2, 3); // [1, 2, 3] test(...[1, 2, 3]); // [1, 2, 3] test(...new ArrayIterator([1, 2, 3])); // [1, 2, 3] // Note: It doesn't really make sense to unpack a constant array like [1, 2, 3]. // Normally these would unpack some variable like ...$args
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZQutg
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 2
          3        SEND_VAL                                                 3
          4        DO_FCALL                                      0          
    6     5        INIT_FCALL                                               'test'
          6        SEND_UNPACK                                              <array>
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      1          
    7     9        INIT_FCALL                                               'test'
         10        NEW                                              $2      'ArrayIterator'
         11        SEND_VAL_EX                                              <array>
         12        DO_FCALL                                      0          
         13        SEND_UNPACK                                              $2
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      1          
   10    16      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZQutg
function name:  test
number of ops:  5
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_VARIADIC                                    !0      
          1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
          4      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
124.33 ms | 1402 KiB | 18 Q