I have this array here that contains a group of duplicate ids each id is set as as array key and the sub array contains a list of ids that also has another array within the same array?

```
DUPLICATES 16

array(16) {
  [19503804]=>
  array(3) {
    [0]=>
    string(8) "19501594"
    [1]=>
    string(8) "15539642"
    [2]=>
    string(8) "19498944"
  }
  [19501594]=>
  array(3) {
    [0]=>
    string(8) "19503804"
    [1]=>
    string(8) "15539642"
    [2]=>
    string(8) "19498944"
  }
  [19837033]=>
  array(6) {
    [0]=>
    string(8) "19854557"
    [1]=>
    string(8) "19854558"
    [2]=>
    string(8) "19854553"
    [3]=>
    string(8) "19854565"
    [4]=>
    string(8) "19854554"
    [5]=>
    string(8) "19854683"
  }
  [19854553]=>
  array(6) {
    [0]=>
    string(8) "19854557"
    [1]=>
    string(8) "19854558"
    [2]=>
    string(8) "19837033"
    [3]=>
    string(8) "19854565"
    [4]=>
    string(8) "19854554"
    [5]=>
    string(8) "19854683"
  }
  [19544216]=>
  array(3) {
    [0]=>
    string(8) "19524884"
    [1]=>
    string(8) "19560234"
    [2]=>
    string(8) "19540264"
  }
  [19854565]=>
  array(6) {
    [0]=>
    string(8) "19854557"
    [1]=>
    string(8) "19854558"
    [2]=>
    string(8) "19837033"
    [3]=>
    string(8) "19854553"
    [4]=>
    string(8) "19854554"
    [5]=>
    string(8) "19854683"
  }
  [19854554]=>
  array(6) {
    [0]=>
    string(8) "19854557"
    [1]=>
    string(8) "19854558"
    [2]=>
    string(8) "19837033"
    [3]=>
    string(8) "19854553"
    [4]=>
    string(8) "19854565"
    [5]=>
    string(8) "19854683"
  }
  [15539642]=>
  array(3) {
    [0]=>
    string(8) "19503804"
    [1]=>
    string(8) "19501594"
    [2]=>
    string(8) "19498944"
  }
  [19844271]=>
  array(1) {
    [0]=>
    string(8) "19341140"
  }
  [19498944]=>
  array(3) {
    [0]=>
    string(8) "19503804"
    [1]=>
    string(8) "19501594"
    [2]=>
    string(8) "15539642"
  }
  [16399898]=>
  array(1) {
    [0]=>
    string(8) "15436391"
  }
  [15436391]=>
  array(1) {
    [0]=>
    string(8) "16399898"
  }
  [19341140]=>
  array(1) {
    [0]=>
    string(8) "19844271"
  }
  [19560234]=>
  array(3) {
    [0]=>
    string(8) "19544216"
    [1]=>
    string(8) "19524884"
    [2]=>
    string(8) "19540264"
  }
  [19854683]=>
  array(6) {
    [0]=>
    string(8) "19854557"
    [1]=>
    string(8) "19854558"
    [2]=>
    string(8) "19837033"
    [3]=>
    string(8) "19854553"
    [4]=>
    string(8) "19854565"
    [5]=>
    string(8) "19854554"
  }
  [19540264]=>
  array(3) {
    [0]=>
    string(8) "19544216"
    [1]=>
    string(8) "19524884"
    [2]=>
    string(8) "19560234"
  }
}

```

notice first array? 

```
    [19503804]=>
  array(3) {
    [0]=>
    string(8) "19501594"
    [1]=>
    string(8) "15539642"
    [2]=>
    string(8) "19498944"
  }

```

the "19501594" "15539642" "19498944" also has another array which need to be unset.so at the end in this array only the unique arrays with unique values are given.

and this is the expected output required.

```
array(5) {
  [19503804]=>
  array(3) {
    [0]=>
    string(8) "19501594"
    [1]=>
    string(8) "15539642"
    [2]=>
    string(8) "19498944"
  }
  [19837033]=>
  array(6) {
    [0]=>
    string(8) "19854557"
    [1]=>
    string(8) "19854558"
    [2]=>
    string(8) "19854553"
    [3]=>
    string(8) "19854565"
    [4]=>
    string(8) "19854554"
    [5]=>
    string(8) "19854683"
  }
  [19544216]=>
  array(3) {
    [0]=>
    string(8) "19524884"
    [1]=>
    string(8) "19560234"
    [2]=>
    string(8) "19540264"
  }

  [19844271]=>
  array(1) {
    [0]=>
    string(8) "19341140"
  }
  [16399898]=>
  array(1) {
    [0]=>
    string(8) "15436391"
  }
}

```

This is what i had initially coded as proposed by @Dale in the answer below.

```
$theduplicates = array (
  19503804 => 
  array (
    0 => '19501594',
    1 => '15539642',
    2 => '19498944',
  ),
  19501594 => 
  array (
    0 => '19503804',
    1 => '15539642',
    2 => '19498944',
  ),
  19837033 => 
  array (
    0 => '19854557',
    1 => '19854558',
    2 => '19854553',
    3 => '19854565',
    4 => '19854554',
    5 => '19854683',
  ),
  19854553 => 
  array (
    0 => '19854557',
    1 => '19854558',
    2 => '19837033',
    3 => '19854565',
    4 => '19854554',
    5 => '19854683',
  ),
  19544216 => 
  array (
    0 => '19524884',
    1 => '19560234',
    2 => '19540264',
  ),
  19854565 => 
  array (
    0 => '19854557',
    1 => '19854558',
    2 => '19837033',
    3 => '19854553',
    4 => '19854554',
    5 => '19854683',
  ),
  19854554 => 
  array (
    0 => '19854557',
    1 => '19854558',
    2 => '19837033',
    3 => '19854553',
    4 => '19854565',
    5 => '19854683',
  ),
  15539642 => 
  array (
    0 => '19503804',
    1 => '19501594',
    2 => '19498944',
  ),
  19844271 => 
  array (
    0 => '19341140',
  ),
  19498944 => 
  array (
    0 => '19503804',
    1 => '19501594',
    2 => '15539642',
  ),
  16399898 => 
  array (
    0 => '15436391',
  ),
  15436391 => 
  array (
    0 => '16399898',
  ),
  19341140 => 
  array (
    0 => '19844271',
  ),
  19560234 => 
  array (
    0 => '19544216',
    1 => '19524884',
    2 => '19540264',
  ),
  19854683 => 
  array (
    0 => '19854557',
    1 => '19854558',
    2 => '19837033',
    3 => '19854553',
    4 => '19854565',
    5 => '19854554',
  ),
  19540264 => 
  array (
    0 => '19544216',
    1 => '19524884',
    2 => '19560234',
  ),
)

foreach($theduplicates as $k => $v){
    foreach($v as $d){
        if(isset($theduplicates[$d])){
        unset($theduplicates[$d]);
    }
}
// but it totally cleans theduplicates array
array(0) {
}

```