我希望我能解釋我想要做的 - 真的希望有人能夠幫助!這裏是數組我與PHP:需要根據維中的一個鍵合併/排序多維數組
(
[0] => Array
(
[city] => Middletown
[state] => OH
[freq] => 146.610
[pl] => 77.0
[call] => W8BLV
[distance] => 0.0
[notes] => ottel
)
[1] => Array
(
[city] => Middletown
[state] => OH
[freq] => 146.715
[pl] =>
[call] => N8COZ
[distance] => 0.0
[notes] => ct
)
[2] => Array
(
[city] => Middletown
[state] => OH
[freq] => 147.315
[pl] => 77.0
[call] => W8JEU
[distance] => 0.0
[notes] => ottel
)
[3] => Array
(
[city] => Middletown
[state] => OH
[freq] => 443.5370
[pl] => 118.8
[call] => W8MUM
[distance] => 0.0
[notes] => oe oe
)
[4] => Array
(
[city] => Middletown
[state] => OH
[freq] => 444.4750
[pl] => 100.0
[call] => AG8Y
[distance] => 0.0
[notes] => ottel
)
[5] => Array
(
[city] => Middletown
[state] => OH
[freq] => 444.8250
[pl] => 77.0
[call] => W8BLV
[distance] => 0.0
[notes] => oel
)
[6] => Array
(
[city] => Monroe
[state] => OH
[freq] => 443.0870
[pl] =>
[call] => KC8ECK
[distance] => 4.3
[notes] => oep
)
[7] => Array
(
[city] => Franklin
[state] => OH
[freq] => 145.290
[pl] => 118.8
[call] => WB8ZVL
[distance] => 5.5
[notes] => o(ca)r
)
[8] => Array
(
[city] => Franklin
[state] => OH
[freq] => 442.4250
[pl] => 77.0
[call] => WE8N
[distance] => 5.5
[notes] => Oae(ca)
)
[9] => Array
(
[city] => Franklin
[state] => OH
[freq] => 443.1500
[pl] => 118.8
[call] => WB8ZVL
[distance] => 5.5
[notes] => o(ca)r
)
[10] => Array
(
[city] => Springboro
[state] => OH
[freq] => 145.490
[pl] => 77.0
[call] => W8CYE
[distance] => 8.9
[notes] => oe
)
)
輸出工作,我希望得到的需求是這樣的:
$rpt[0] ="Middletown 146.61/77, 146.715, 147.315/77, 443.537/118.8, 444.475/100, 444.825/77";
$rpt[1] = "Monroe 443.087";
$rpt[2] = "Franklin 145.29/118.8, 442.425/77, 443.15/118.8";
$rpt[3] = "Springboro 145.49/77"
我最感興趣的是城市,頻率的領域, PL - 如果你看看第一個數組,我已經刪除了輸出數組上的尾隨零。 也有幾次,當我可能需要使用呼叫字段和筆記字段時,但是如果有人能指向我正確的方向,我可能會計算出 我需要的其餘部分 - 呼叫字段和筆記字段不會經常使用。 我已經嘗試了幾個不同的foreach循環,但我仍然是PHP的新手 - 而且我所做的工作並不正確,而且我在這點上需要一些幫助。
在此先感謝您的幫助, 樂華,KD8BXP
琥珀,感謝您的快速答案...不太我所期待的事,但要更接近當時我讓我的自己的!我想我可以爲你工作。非常感謝你的幫助。 LeRoy,KD8BXP – 2010-07-21 04:14:29
嗯。讓我看看我是否可以調整它以更貼近地滿足您的需求。 :) – Amber 2010-07-21 04:20:13
看看我添加在底部的位是否有幫助。 – Amber 2010-07-21 04:25:30