3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rrDatas = [ [], [ "asset" => 1, "person" => 1, ], [ "asset" => 2, ], [ "test" => 1, "person" => 1, ], [ "person" => 1, "banana" => "hello", "person" => 4, ], ]; $output = []; // Prepare empty output foreach($rrDatas as $inner){ foreach($inner as $key => $value){ $output[$key][] = $value; } } echo json_encode($output); // {"asset":[1,2],"person":[1]}
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/KSmm7
function name:  (null)
number of ops:  19
compiled vars:  !0 = $rrDatas, !1 = $output, !2 = $inner, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, <array>
   23     2      > FE_RESET_R                                       $7      !0, ->13
          3    > > FE_FETCH_R                                               $7, !2, ->13
   24     4    > > FE_RESET_R                                       $8      !2, ->11
          5    > > FE_FETCH_R                                       ~9      $8, !3, ->11
          6    >   ASSIGN                                                   !4, ~9
   25     7        FETCH_DIM_W                                      $11     !1, !4
          8        ASSIGN_DIM                                               $11
          9        OP_DATA                                                  !3
   24    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $8
   23    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $7
   29    14        INIT_FCALL                                               'json_encode'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $13     
         17        ECHO                                                     $13
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.05 ms | 1000 KiB | 14 Q