我需要計數重複的多維數組,刪除此重複項,並推入計算在新索引中重複。通過索引和值組的多維數組
假設一個我有這樣的數組:
Array
(
[0] => Array
(
[segments] => Array
(
[1] => Gcia de Auditoría Interna
[0] => Auditoria Interna 1
)
[groups] => Array
(
[estados] => sp
[cidade] => sumpaulo
)
)
[1] => Array
(
[segments] => Array
(
[2] => Gerencia Recursos Humanos
[1] => Gcia Dpto Admin de Pers. y Rel. Laboral
[0] => SubGcia Administración de Personal
)
[groups] => Array
(
[estados] => sp
[cidade] =>
)
)
[2] => Array
(
[segments] => Array
(
[2] => Gerencia Recursos Humanos
[1] => Gcia Dpto Admin de Pers. y Rel. Laboral
[0] => SubGcia Administración de Personal
)
[groups] => Array
(
[estados] => sp
[cidade] =>
)
)
)
我想刪除重複的數組,並創建新的索引數:
Array
(
[0] => Array
(
[segments] => Array
(
[1] => Gcia de Auditoría Interna
[0] => Auditoria Interna 1
)
[groups] => Array
(
[estados] => sp
[cidade] => sumpaulo
)
[total] = 1
)
[1] => Array
(
[segments] => Array
(
[2] => Gerencia Recursos Humanos
[1] => Gcia Dpto Admin de Pers. y Rel. Laboral
[0] => SubGcia Administración de Personal
)
[groups] => Array
(
[estados] => sp
[cidade] =>
)
[total] = 2
)
)
這可能嗎?
這當然也可以使用疊加'foreach's ... – Passerby