I have a huge multidimensional array and I need to remove duplicate values with PHP or some function that does this when using CakePHP. Array structure:
Array
(
[0] => Array
(
[Advertencia] => Array
(
[id] =>
[tipo_punicao] => CA
[suspensao_data_inicio] =>
[funcionario_matricula] =>
[advertente_matricula] =>
[recebedor_RH_matricula] =>
)
[Funcionario] => Array
(
[id] => 25
[matricula] => 5444
[nome] => ANDRE
[quantidade] =>
)
)
[1] => Array
(
[Advertencia] => Array
(
[id] =>
[tipo_punicao] => A
[suspensao_data_inicio] =>
[funcionario_matricula] =>
[advertente_matricula] =>
[recebedor_RH_matricula] =>
)
[Funcionario] => Array
(
[id] => 20
[matricula] => 5555
[nome] => JOAO
[quantidade] =>
)
)
[2] => Array
(
[Advertencia] => Array
(
[id] =>
[tipo_punicao] => RC
[suspensao_data_inicio] =>
[funcionario_matricula] =>
[advertente_matricula] =>
[recebedor_RH_matricula] =>
)
[Funcionario] => Array
(
[id] => 20
[matricula] => 5555
[nome] => JOAO
[quantidade] =>
)
)
)
Notice that two of these data in the array have the same information, that is, [1]
and [2]
- where nome
, matricula
and id
are equal. I would like one of these data to be removed. It does not matter which one will stay. It would look like this, for example:
Array
(
[0] => Array
(
[Advertencia] => Array
(
[id] =>
[tipo_punicao] => CA
[suspensao_data_inicio] =>
[funcionario_matricula] =>
[advertente_matricula] =>
[recebedor_RH_matricula] =>
)
[Funcionario] => Array
(
[id] => 25
[matricula] => 5444
[nome] => ANDRE
[quantidade] =>
)
)
[1] => Array
(
[Advertencia] => Array
(
[id] =>
[tipo_punicao] => A
[suspensao_data_inicio] =>
[funcionario_matricula] =>
[advertente_matricula] =>
[recebedor_RH_matricula] =>
)
[Funcionario] => Array
(
[id] => 20
[matricula] => 5555
[nome] => JOAO
[quantidade] =>
)
)
)
Is it possible?