3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( 0 => array('value' => 1000, 'name' => 'AA1'), 1 => array('value' => 2000, 'name' => 'AA2'), 2 => array('value' => 3000, 'name' => 'AA3'), 3 => array('value' => 4000, 'name' => 'AA4'), ); $b = array( 0 => array('value' => 1000, 'name' => 'BB1'), 1 => array('value' => 3000, 'name' => 'BB2'), 2 => array('value' => 1700, 'name' => 'BB3'), 3 => array('value' => 1200, 'name' => 'BB4'), ); $c = array( 0 => array('value' => 3000, 'name' => 'CC1'), 1 => array('value' => 4000, 'name' => 'CC2'), 2 => array('value' => 4300, 'name' => 'CC3'), 3 => array('value' => 5000, 'name' => 'CC4'), ); $array = array('a' => $a, 'b' => $b, 'c' =>$c); foreach($array as $letter => $subArray){ foreach($subArray as $key => $values){ $newArray[$letter.$key] = $values['value']; } } $uniques = array_unique($newArray); //getting the non-repeated values $repeated = array_diff_assoc($newArray, $uniques); // stripping them out $final = array_unique($repeated); //cleaning the repeated values to just 1 of each print_r($final);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/8ZW7H
function name:  (null)
number of ops:  38
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $array, !4 = $subArray, !5 = $letter, !6 = $values, !7 = $key, !8 = $newArray, !9 = $uniques, !10 = $repeated, !11 = $final
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   14     2        ASSIGN                                                   !2, <array>
   21     3        INIT_ARRAY                                       ~15     !0, 'a'
          4        ADD_ARRAY_ELEMENT                                ~15     !1, 'b'
          5        ADD_ARRAY_ELEMENT                                ~15     !2, 'c'
          6        ASSIGN                                                   !3, ~15
   22     7      > FE_RESET_R                                       $17     !3, ->20
          8    > > FE_FETCH_R                                       ~18     $17, !4, ->20
          9    >   ASSIGN                                                   !5, ~18
   23    10      > FE_RESET_R                                       $20     !4, ->18
         11    > > FE_FETCH_R                                       ~21     $20, !6, ->18
         12    >   ASSIGN                                                   !7, ~21
   24    13        CONCAT                                           ~23     !5, !7
         14        FETCH_DIM_R                                      ~25     !6, 'value'
         15        ASSIGN_DIM                                               !8, ~23
         16        OP_DATA                                                  ~25
   23    17      > JMP                                                      ->11
         18    >   FE_FREE                                                  $20
   22    19      > JMP                                                      ->8
         20    >   FE_FREE                                                  $17
   28    21        INIT_FCALL                                               'array_unique'
         22        SEND_VAR                                                 !8
         23        DO_ICALL                                         $26     
         24        ASSIGN                                                   !9, $26
   29    25        INIT_FCALL                                               'array_diff_assoc'
         26        SEND_VAR                                                 !8
         27        SEND_VAR                                                 !9
         28        DO_ICALL                                         $28     
         29        ASSIGN                                                   !10, $28
   30    30        INIT_FCALL                                               'array_unique'
         31        SEND_VAR                                                 !10
         32        DO_ICALL                                         $30     
         33        ASSIGN                                                   !11, $30
   32    34        INIT_FCALL                                               'print_r'
         35        SEND_VAR                                                 !11
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.85 ms | 1392 KiB | 19 Q