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['value']][] = $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 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
Branch analysis from position: 18
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 18
filename:       /in/gaELN
function name:  (null)
number of ops:  29
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, ->18
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->18
          4    >   ASSIGN                                                   !3, ~8
   57     5      > FE_RESET_R                                       $10     !2, ->16
          6    > > FE_FETCH_R                                               $10, !4, ->16
   58     7    >   FETCH_DIM_R                                      ~11     !4, 'name'
          8        CONCAT                                           ~12     ~11, '%7C'
          9        FETCH_DIM_R                                      ~13     !4, 'value'
         10        CONCAT                                           ~14     ~12, ~13
         11        FETCH_DIM_R                                      ~17     !4, 'id'
         12        FETCH_DIM_W                                      $15     !1, ~14
         13        ASSIGN_DIM                                               $15
         14        OP_DATA                                                  ~17
   57    15      > JMP                                                      ->6
         16    >   FE_FREE                                                  $10
   56    17      > JMP                                                      ->3
         18    >   FE_FREE                                                  $7
   61    19        INIT_FCALL                                               'array_map'
         20        SEND_VAL                                                 'array_unique'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $18     
         23        ASSIGN                                                   !1, $18
   62    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > EXIT                                                     
   63    28*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.8 ms | 1012 KiB | 15 Q