php使用递归从多维关联数组中删除重复项

I'm trying to remove duplicated entries where value and type are both equal on a multidimensional associative array, but only using recursion and without array_unique. All keys are associative.

I tried this, and I'm getting the same result as the main array. My logic seems to fail me at this late hour.

function rmDuplicates(&$array) {
  $uniqueArray = array();
  foreach($array as $k=>$v) {
     if (is_array($v)) {
       $uniqueArray[$k] = rmDuplicates($v);
     } else {
       if (!in_array($v, $uniqueArray)) {
         $uniqueArray[] = $v;
       }
     }
  }
  return $uniqueArray;
}