我希望我能解释我想要做的 - 真的希望有人能够帮助!这里是数组我与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