I'm trying to count the values in a php array and eliminate repetitions have leaving only 1. The format of my arrangement is as follows:
Array
(
[0] => Array
(
[inscripcion_id] => 3932
[nombre] => Prueba
[email] => [email protected]
)
[1] => Array
(
[inscripcion_id] => 3926
[nombre] => Prueba
[email] => [email protected]
)
[2] => Array
(
[inscripcion_id] => 3921
[nombre] => Nicolas
[email] => [email protected]
)
)
I look matches are based on the email field, if the email appears more than 1 time in the arrangements must be eliminated leaving only 1. The problem is I can not get as often appears no less eliminate it. Try array_count_values does not work, I can find the matches of each email but only in the subarray therefore always find 1 each as follows for example:
Array ( [3932] => 1 [Prueba] => 1 [[email protected]] => 1 )
Array ( [3926] => 1 [Prueba] => 1 [[email protected]] => 1 )
I hope the result is this:
Array
(
[0] => Array
(
[inscripcion_id] => 3932
[nombre] => Prueba
[email] => [email protected]
)
[1] => Array
(
[inscripcion_id] => 3921
[nombre] => Nicolas
[email] => [email protected]
)
)