3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( 'data' => array( array( 'raw' => array( 'key1' => array('value1', 'value1_1'), 'key3' => 'value3', ), ), array( 'raw' => array( 'key1' => array('value1_3', 'value1_4'), 'key2' => 'value3_1', ), ), ), ); $array2 = array( 'data' => array( array( 'raw' => array( 'key1' => 'value1_2', 'key2' => 'value2', 'key3' => array('value3_1', 'value3_2'), ) ) ) ); foreach ($array1['data'] as $set) { foreach ($set['raw'] as $k => $v) { if (!isset($result['data']['raw'][$k])) { $result['data']['raw'][$k] = $v; }else { $result['data']['raw'][$k] = array_merge((array)$result['data']['raw'][$k],(array)$v); } } } foreach ($array2['data'] as $set) { foreach ($set['raw'] as $k => $v) { if (!isset($result['data']['raw'][$k])) { $result['data']['raw'][$k] = $v; }else{ $result['data']['raw'][$k] = array_merge((array)$result['data']['raw'][$k],(array)$v); } } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 35
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 35
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 33
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 33
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 33
Branch analysis from position: 35
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 69
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 69
Branch analysis from position: 39
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 67
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 67
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 53
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 67
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
Branch analysis from position: 35
filename:       /in/BMVa7
function name:  (null)
number of ops:  74
compiled vars:  !0 = $array1, !1 = $array2, !2 = $set, !3 = $v, !4 = $k, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, <array>
   31     2        FETCH_DIM_R                                      ~8      !0, 'data'
          3      > FE_RESET_R                                       $9      ~8, ->35
          4    > > FE_FETCH_R                                               $9, !2, ->35
   32     5    >   FETCH_DIM_R                                      ~10     !2, 'raw'
          6      > FE_RESET_R                                       $11     ~10, ->33
          7    > > FE_FETCH_R                                       ~12     $11, !3, ->33
          8    >   ASSIGN                                                   !4, ~12
   33     9        FETCH_DIM_IS                                     ~14     !5, 'data'
         10        FETCH_DIM_IS                                     ~15     ~14, 'raw'
         11        ISSET_ISEMPTY_DIM_OBJ                         0  ~16     ~15, !4
         12        BOOL_NOT                                         ~17     ~16
         13      > JMPZ                                                     ~17, ->19
   34    14    >   FETCH_DIM_W                                      $18     !5, 'data'
         15        FETCH_DIM_W                                      $19     $18, 'raw'
         16        ASSIGN_DIM                                               $19, !4
         17        OP_DATA                                                  !3
   33    18      > JMP                                                      ->32
   36    19    >   INIT_FCALL                                               'array_merge'
         20        FETCH_DIM_R                                      ~24     !5, 'data'
         21        FETCH_DIM_R                                      ~25     ~24, 'raw'
         22        FETCH_DIM_R                                      ~26     ~25, !4
         23        CAST                                          7  ~27     ~26
         24        SEND_VAL                                                 ~27
         25        CAST                                          7  ~28     !3
         26        SEND_VAL                                                 ~28
         27        DO_ICALL                                         $29     
         28        FETCH_DIM_W                                      $21     !5, 'data'
         29        FETCH_DIM_W                                      $22     $21, 'raw'
         30        ASSIGN_DIM                                               $22, !4
         31        OP_DATA                                                  $29
   32    32    > > JMP                                                      ->7
         33    >   FE_FREE                                                  $11
   31    34      > JMP                                                      ->4
         35    >   FE_FREE                                                  $9
   40    36        FETCH_DIM_R                                      ~30     !1, 'data'
         37      > FE_RESET_R                                       $31     ~30, ->69
         38    > > FE_FETCH_R                                               $31, !2, ->69
   41    39    >   FETCH_DIM_R                                      ~32     !2, 'raw'
         40      > FE_RESET_R                                       $33     ~32, ->67
         41    > > FE_FETCH_R                                       ~34     $33, !3, ->67
         42    >   ASSIGN                                                   !4, ~34
   42    43        FETCH_DIM_IS                                     ~36     !5, 'data'
         44        FETCH_DIM_IS                                     ~37     ~36, 'raw'
         45        ISSET_ISEMPTY_DIM_OBJ                         0  ~38     ~37, !4
         46        BOOL_NOT                                         ~39     ~38
         47      > JMPZ                                                     ~39, ->53
   43    48    >   FETCH_DIM_W                                      $40     !5, 'data'
         49        FETCH_DIM_W                                      $41     $40, 'raw'
         50        ASSIGN_DIM                                               $41, !4
         51        OP_DATA                                                  !3
   42    52      > JMP                                                      ->66
   45    53    >   INIT_FCALL                                               'array_merge'
         54        FETCH_DIM_R                                      ~46     !5, 'data'
         55        FETCH_DIM_R                                      ~47     ~46, 'raw'
         56        FETCH_DIM_R                                      ~48     ~47, !4
         57        CAST                                          7  ~49     ~48
         58        SEND_VAL                                                 ~49
         59        CAST                                          7  ~50     !3
         60        SEND_VAL                                                 ~50
         61        DO_ICALL                                         $51     
         62        FETCH_DIM_W                                      $43     !5, 'data'
         63        FETCH_DIM_W                                      $44     $43, 'raw'
         64        ASSIGN_DIM                                               $44, !4
         65        OP_DATA                                                  $51
   41    66    > > JMP                                                      ->41
         67    >   FE_FREE                                                  $33
   40    68      > JMP                                                      ->38
         69    >   FE_FREE                                                  $31
   49    70        INIT_FCALL                                               'var_export'
         71        SEND_VAR                                                 !5
         72        DO_ICALL                                                 
         73      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.33 ms | 1020 KiB | 15 Q