3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$bar = array_merge(...['a' => ['b', 'c']]); $ref = new \ReflectionFunction('array_merge'); foreach ($ref->getParameters() as $p) { var_dump($p->getName()); var_dump($p->isOptional()); var_dump($p->isVariadic()); var_dump('---'); } function foo(...$arrays): void { } foo(...['a' => ['b', 'c']]); // works array_merge(...['a' => ['b', 'c']]); // doesn't
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 27
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/bQrhZ
function name:  (null)
number of ops:  37
compiled vars:  !0 = $ref, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $2      'ReflectionFunction'
          1        SEND_VAL_EX                                              'array_merge'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
    6     4        INIT_METHOD_CALL                                         !0, 'getParameters'
          5        DO_FCALL                                      0  $5      
          6      > FE_RESET_R                                       $6      $5, ->27
          7    > > FE_FETCH_R                                               $6, !1, ->27
    7     8    >   INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !1, 'getName'
         10        DO_FCALL                                      0  $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                                 
    8    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !1, 'isOptional'
         15        DO_FCALL                                      0  $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                                 
    9    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !1, 'isVariadic'
         20        DO_FCALL                                      0  $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                                 
   10    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAL                                                 '---'
         25        DO_ICALL                                                 
    6    26      > JMP                                                      ->7
         27    >   FE_FREE                                                  $6
   18    28        INIT_FCALL                                               'foo'
         29        SEND_UNPACK                                              <array>
         30        CHECK_UNDEF_ARGS                                         
         31        DO_FCALL                                      1          
   19    32        INIT_FCALL                                               'array_merge'
         33        SEND_UNPACK                                              <array>
         34        CHECK_UNDEF_ARGS                                         
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bQrhZ
function name:  foo
number of ops:  2
compiled vars:  !0 = $arrays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV_VARIADIC                                    !0      
   16     1      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.12 ms | 1407 KiB | 18 Q