3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['data1' => ['value1' => 1, 'value2' => 2]], ['data2' => ['value5' => 5, 'value6' => 6]], ['data1' => ['value3' => 3, 'value4' => 4]], ]; $result = []; foreach ($array as $set) { foreach ($set as $k => $row) { if (!isset($ref[$k])) { $ref[$k] = $set; $result[] =& $ref[$k]; continue; } $ref[$k][$k] += $row; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/WkINvg
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $result, !2 = $set, !3 = $row, !4 = $k, !5 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $8      !0, ->23
          3    > > FE_FETCH_R                                               $8, !2, ->23
   11     4    > > FE_RESET_R                                       $9      !2, ->21
          5    > > FE_FETCH_R                                       ~10     $9, !3, ->21
          6    >   ASSIGN                                                   !4, ~10
   12     7        ISSET_ISEMPTY_DIM_OBJ                         0  ~12     !5, !4
          8        BOOL_NOT                                         ~13     ~12
          9      > JMPZ                                                     ~13, ->17
   13    10    >   ASSIGN_DIM                                               !5, !4
         11        OP_DATA                                                  !2
   14    12        FETCH_DIM_W                                      $16     !5, !4
         13        MAKE_REF                                         $17     $16
         14        FETCH_DIM_W                                      $15     !1
         15        ASSIGN_REF                                               $15, $17
   15    16      > JMP                                                      ->5
   17    17    >   FETCH_DIM_RW                                     $19     !5, !4
         18        ASSIGN_DIM_OP                +=               1          $19, !4
         19        OP_DATA                                                  !3
   11    20      > JMP                                                      ->5
         21    >   FE_FREE                                                  $9
   10    22      > JMP                                                      ->3
         23    >   FE_FREE                                                  $8
   20    24        INIT_FCALL                                               'var_export'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.45 ms | 1011 KiB | 14 Q