<?php
"id" => "",
"tipo_punicao" => "CA",
"suspensao_data_inicio" => "",
"funcionario_matricula" => "",
"advertente_matricula" => "",
"recebedor_RH_matricula" => ""
),
"id" => 25,
"matricula" => 5444,
"nome" => "ANDRE",
"quantidade" => "",
)
),
"id" => "",
"tipo_punicao" => "A",
"suspensao_data_inicio" => "",
"funcionario_matricula" => "",
"advertente_matricula" => "",
"recebedor_RH_matricula" => ""
),
"id" => 20,
"matricula" => 5555,
"nome" => "JOAO",
"quantidade" => ""
)
),
"id" => "",
"tipo_punicao" => "RC",
"suspensao_data_inicio" => "",
"funcionario_matricula" => "",
"advertente_matricula" => "",
"recebedor_RH_matricula" => ""
),
"id" => 20,
"matricula" => 5555,
"nome" => "JOAO",
"quantidade" => ""
)
)
);
function in_array_recursive($agulha, $palheiro) {
foreach ($palheiro as $item) {
if (($item == $agulha) || (is_array($item) && in_array_recursive
($agulha, $item))) return true;
}
return false;
}
function uniqueArray($raiz){
$unique = [];
foreach ($raiz as $nodo => $nodos){
foreach ($nodos as $item => $items){
foreach ($items as $chave => $valor){
if (!in_array_recursive
($valor, $unique) or
empty($valor)){ $unique[$nodo][$item][$chave] = $valor;
} else {
break 3;
}
}
}
}
return $unique;
}
$unique = uniqueArray($dupArray);
echo "<pre>". print_r($unique, 1). "<pre>";
?>
PD9waHAKCiRkdXBBcnJheSA9IGFycmF5KDAgPT4gYXJyYXkoCiAgICAgICAgIkFkdmVydGVuY2lhIiA9PiBhcnJheSgKICAgICAgICAgICAgICAgICJpZCIgPT4gIiIsCiAgICAgICAgICAgICAgICAidGlwb19wdW5pY2FvIiA9PiAiQ0EiLAogICAgICAgICAgICAgICAgInN1c3BlbnNhb19kYXRhX2luaWNpbyIgPT4gIiIsIAogICAgICAgICAgICAgICAgImZ1bmNpb25hcmlvX21hdHJpY3VsYSIgPT4gIiIsIAogICAgICAgICAgICAgICAgImFkdmVydGVudGVfbWF0cmljdWxhIiA9PiAgIiIsIAogICAgICAgICAgICAgICAgInJlY2ViZWRvcl9SSF9tYXRyaWN1bGEiID0+ICIiIAogICAgICAgICksCgogICAgICAgICJGdW5jaW9uYXJpbyIgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAiaWQiID0+IDI1LAogICAgICAgICAgICAgICAgIm1hdHJpY3VsYSIgPT4gNTQ0NCwKICAgICAgICAgICAgICAgICJub21lIiA9PiAiQU5EUkUiLAogICAgICAgICAgICAgICAgInF1YW50aWRhZGUiID0+ICIiLAogICAgICAgICkKICAgICksCgogICAgICAgICAgICAgICAgICAgICAxID0+IGFycmF5KAogICAgICAgICJBZHZlcnRlbmNpYSIgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAiaWQiID0+ICIiLAogICAgICAgICAgICAgICAgInRpcG9fcHVuaWNhbyIgPT4gIkEiLAogICAgICAgICAgICAgICAgInN1c3BlbnNhb19kYXRhX2luaWNpbyIgPT4gIiIsCiAgICAgICAgICAgICAgICAiZnVuY2lvbmFyaW9fbWF0cmljdWxhIiA9PiAiIiwKICAgICAgICAgICAgICAgICJhZHZlcnRlbnRlX21hdHJpY3VsYSIgPT4gIiIsCiAgICAgICAgICAgICAgICAicmVjZWJlZG9yX1JIX21hdHJpY3VsYSIgPT4gIiIKICAgICAgICApLAoKICAgICAgICAiRnVuY2lvbmFyaW8iID0+IGFycmF5KAogICAgICAgICAgICAgICAgImlkIiA9PiAyMCwKICAgICAgICAgICAgICAgICJtYXRyaWN1bGEiID0+IDU1NTUsCiAgICAgICAgICAgICAgICAibm9tZSIgPT4gIkpPQU8iLCAKICAgICAgICAgICAgICAgICJxdWFudGlkYWRlIiA9PiAiIgogICAgICAgICAgICApCiAgICApLAoKICAgICAgICAgICAgICAgICAgICAgMiA9PiBhcnJheSgKICAgICAgICAiQWR2ZXJ0ZW5jaWEiID0+IGFycmF5KAogICAgICAgICAgICAgICAgImlkIiA9PiAiIiwKICAgICAgICAgICAgICAgICJ0aXBvX3B1bmljYW8iID0+ICJSQyIsCiAgICAgICAgICAgICAgICAic3VzcGVuc2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