我有这个数组,我想从我的数组中只获得重复数据。 我该怎么做才能帮忙
我有这个数组:
Array
(
[Yeppoon] => Array
(
[1] => Array
(
[LATE MAIL] => Array
(
[5] => BARACHIEL
)
[RUSSEL LEONARD] => Array
(
[5] => BARACHIEL
)
[CHRIS NELSON] => Array
(
[2] => SERIOUS CAPER
)
)
[2] => Array
(
[LATE MAIL] => Array
(
[3] => AL HAMEES
)
[RUSSEL LEONARD] => Array
(
[1] => EMPEROR MAXIMILIAN
)
[CHRIS NELSON] => Array
(
[1] => EMPEROR MAXIMILIAN
)
)
[3] => Array
(
[LATE MAIL] => Array
(
[8] => STYLISH LUCK
)
[RUSSEL LEONARD] => Array
(
[1] => WALK TO THE BAR
)
[CHRIS NELSON] => Array
(
[5] => ALL HOST
)
)
[4] => Array
(
[LATE MAIL] => Array
(
[4] => MATAGAMI
)
[ANTHONY COLLINS] => Array
(
[4] => MATAGAMI
)
[JULIE ROWLAND] => Array
(
[6] => OUR METEOR
)
)
)
[Goulburn] => Array
(
[1] => Array
(
[LATE MAIL] => Array
(
[2] => ALL IN RHYTHM
)
[LUKE MARLOW] => Array
(
[7] => NACHO LIBRE
)
[IAN HUMPHRIES] => Array
(
[7] => NACHO LIBRE
)
)
[2] => Array
(
[LATE MAIL] => Array
(
[9] => KIARRA ROSE
)
[LUKE MARLOW] => Array
(
[4] => USENA
)
[IAN HUMPHRIES] => Array
(
[9] => KIARRA ROSE
)
)
)
[Huntingdon] => Array
(
[1] => Array
(
[RADIO TAB] => Array
(
[5] => BURNING HEAT
)
)
[2] => Array
(
[RADIO TAB] => Array
(
[1] => LA BAGUE AU ROI
)
)
[3] => Array
(
[RADIO TAB] => Array
(
[7] => TUDORS TREASURE
)
)
[4] => Array
(
[RADIO TAB] => Array
(
[2] => HAMMERSLY LAKE
)
)
)
[Benalla] => Array
(
[1] => Array
(
[RICK MCINTOSH] => Array
(
[1] => MALMAS
)
[KEVIN CASEY] => Array
(
[1] => MALMAS
)
)
[2] => Array
(
[RICK MCINTOSH] => Array
(
[6] => UNDER OATH
)
[KEVIN CASEY] => Array
(
[6] => UNDER OATH
)
)
[3] => Array
(
[RICK MCINTOSH] => Array
(
[4] => STAR OF SEVILLE
)
[KEVIN CASEY] => Array
(
[14] => PRATING
)
)
[4] => Array
(
[RICK MCINTOSH] => Array
(
[7] => ORANGE RIVER
)
[KEVIN CASEY] => Array
(
[7] => ORANGE RIVER
)
)
)
)
我需要在数组中只找到重复的值并创建带有重复项的新数组。
我想要这个结果:
Array
(
[Yeppoon] => Array
(
[1] => Array
(
[5] => BARACHIEL
)
[2] => Array
(
[1] => EMPEROR MAXIMILIAN
)
[4] => Array
(
[4] => MATAGAMI
)
)
[Goulburn] => Array
(
[1] => Array
(
[7] => NACHO LIBRE
)
[2] => Array
(
[9] => KIARRA ROSE
)
)
[Huntingdon] => Array
(
[1] => Array
(
[5] => BURNING HEAT
)
[2] => Array
(
[1] => LA BAGUE AU ROI
)
[3] => Array
(
[7] => TUDORS TREASURE
)
[4] => Array
(
[2] => HAMMERSLY LAKE
)
)
[Benalla] => Array
(
[1] => Array
(
[1] => MALMAS
)
[2] => Array
(
[6] => UNDER OATH
)
[4] => Array
(
[7] => ORANGE RIVER
)
)
)
Thanx很多!
它可以与AlexxxTsyk代码配合使用。
foreach ($buffer as $key => $array) {
foreach ($array as $arrKey => $items) {
foreach ($items as $itemKey => $itemNames) {
if ((count($itemNames) > 1) OR (count($items) == 1)) {
$arrayYouNeed[$key][$arrKey] = array($itemKey => $itemNames[0]);
}
}
}
}
答案 0 :(得分:0)
explode()