3v4l.org

run code in 300+ PHP versions simultaneously
<?php function multiArrayCombine() { $transposed = array_map(null, ...func_get_args()); foreach ($transposed as &$set) { $set = array_merge(...array_filter($set)); } return $transposed; } $array1 = [['a' => 'val1'], ['a' => 'val2']]; $array2 = [['b' => 'val3'], ['b' => 'val4']]; $array3 = [['c' => 'val5'], [], ['c' => 'val6']]; var_export(multiArrayCombine($array1, $array2, $array3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N8N8h
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   11     2        ASSIGN                                                   !2, <array>
   12     3        INIT_FCALL                                               'var_export'
          4        INIT_FCALL                                               'multiarraycombine'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function multiarraycombine:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/N8N8h
function name:  multiArrayCombine
number of ops:  21
compiled vars:  !0 = $transposed, !1 = $set
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_map'
          1        SEND_VAL                                                 null
          2        FUNC_GET_ARGS                                    ~2      
          3        SEND_UNPACK                                              ~2
          4        CHECK_UNDEF_ARGS                                         
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
    4     7      > FE_RESET_RW                                      $5      !0, ->18
          8    > > FE_FETCH_RW                                              $5, !1, ->18
    5     9    >   INIT_FCALL                                               'array_merge'
         10        INIT_FCALL                                               'array_filter'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $6      
         13        SEND_UNPACK                                              $6
         14        CHECK_UNDEF_ARGS                                         
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !1, $7
    4    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $5
    7    19      > RETURN                                                   !0
    8    20*     > RETURN                                                   null

End of function multiarraycombine

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.02 ms | 1403 KiB | 22 Q