3v4l.org

run code in 300+ PHP versions simultaneously
<?php function oldWay(string ...$packages): array { $existingPackages = ['a', 'b']; return $existingPackages += $packages; } function newWay(string ...$packages): array { $existingPackages = ['a', 'b']; return [...$existingPackages, ...$packages]; } var_dump(oldway('c', 'd'), newWay('c', 'd'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FL7cV
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'oldway'
          2        SEND_VAL                                                 'c'
          3        SEND_VAL                                                 'd'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        INIT_FCALL                                               'newway'
          7        SEND_VAL                                                 'c'
          8        SEND_VAL                                                 'd'
          9        DO_FCALL                                      0  $1      
         10        SEND_VAR                                                 $1
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function oldway:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FL7cV
function name:  oldWay
number of ops:  7
compiled vars:  !0 = $packages, !1 = $existingPackages
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_VARIADIC                                    !0      
    5     1        ASSIGN                                                   !1, <array>
    7     2        ASSIGN_OP                                     1  ~3      !1, !0
          3        VERIFY_RETURN_TYPE                                       ~3
          4      > RETURN                                                   ~3
    8     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function oldway

Function newway:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FL7cV
function name:  newWay
number of ops:  9
compiled vars:  !0 = $packages, !1 = $existingPackages
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV_VARIADIC                                    !0      
   12     1        ASSIGN                                                   !1, <array>
   14     2        INIT_ARRAY                                       ~3      
          3        ADD_ARRAY_UNPACK                                 ~3      !1
          4        ADD_ARRAY_UNPACK                                 ~3      !0
          5        VERIFY_RETURN_TYPE                                       ~3
          6      > RETURN                                                   ~3
   15     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function newway

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.95 ms | 1013 KiB | 16 Q