3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ '0' => [ '0' => [ 'name' => 'brand', 'value' => 54, 'id' => 5251, 'price' => 15000.0000, ], '1' => [ 'name' => 'model', 'value' => 1200, 'id' => 5251, 'price' => 15000.0000, ], ], '1' => [ '0' => [ 'name' => 'brand', 'value' => 54, 'id' => 5250, 'price' => 15000.0000, ], '1' => [ 'name' => 'brand', 'value' => 1200, 'id' => 5250, 'price' => 12000.0000, ], ], '2' => [ '0' => [ 'name' => 'brand', 'value' => 89, 'id' => 518, 'price' => 100.0000, ], '1' => [ 'name' => 'model', 'value' => 12, 'id' => 518, 'price' => 100, ], ], ]; $result =[]; foreach ($arr as $key => $value) { foreach($value as $v){ $result[$v['name']][] = $v['id']; } } $result = array_map("array_unique", $result); print_r($result);die;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
Branch analysis from position: 15
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 15
filename:       /in/GAKuu
function name:  (null)
number of ops:  26
compiled vars:  !0 = $arr, !1 = $result, !2 = $value, !3 = $key, !4 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   55     1        ASSIGN                                                   !1, <array>
   56     2      > FE_RESET_R                                       $7      !0, ->15
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->15
          4    >   ASSIGN                                                   !3, ~8
   57     5      > FE_RESET_R                                       $10     !2, ->13
          6    > > FE_FETCH_R                                               $10, !4, ->13
   58     7    >   FETCH_DIM_R                                      ~11     !4, 'name'
          8        FETCH_DIM_R                                      ~14     !4, 'id'
          9        FETCH_DIM_W                                      $12     !1, ~11
         10        ASSIGN_DIM                                               $12
         11        OP_DATA                                                  ~14
   57    12      > JMP                                                      ->6
         13    >   FE_FREE                                                  $10
   56    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $7
   61    16        INIT_FCALL                                               'array_map'
         17        SEND_VAL                                                 'array_unique'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $15     
         20        ASSIGN                                                   !1, $15
   62    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > EXIT                                                     
   63    25*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.13 ms | 1012 KiB | 15 Q