으로 배열을 병합하는 방법이내가 그것의 내 배열을 에코 할 때 같은 값
[0] => Array
(
[carriertype] =>
[radiotype] => RRUS 12 B2
[serialnumber] => CF82943634
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 16
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-7
[userlabletext] => 225011_1_4
[flag] => Yes
)
[1] => Array
(
[carriertype] =>
[radiotype] => RRUS 12 B2
[serialnumber] => CF82961338
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 15
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-8
[userlabletext] => 225011_2_4
[flag] => Yes
)
[2] => Array
(
[carriertype] =>
[radiotype] => RRUS 12 B2
[serialnumber] => CF82943628
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 14
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-9
[userlabletext] => 225011_3_4
[flag] => Yes
)
[3] => Array
(
[radiotype] =>
[carriertype] =>
[serialnumber] =>
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 1
[EP_AuxPlugInUnit_AuxPlugInUnitId] =>
[userlabletext] => ___B
[flag] => Yes
)
[4] => Array
(
[radiotype] =>
[carriertype] =>
[serialnumber] =>
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 1
[EP_AuxPlugInUnit_AuxPlugInUnitId] =>
[userlabletext] => ___E
[flag] => Yes
)
[5] => Array
(
[carriertype] => AWS
[radiotype] => RRUS 12 B4
[serialnumber] => CF81666912
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 16
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-5
[userlabletext] => 225011_2_2
[flag] => Yes
)
[6] => Array
(
[carriertype] => AWS
[radiotype] => RRUS 12 B4
[serialnumber] => CF81666918
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 14
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-6
[userlabletext] => 225011_3_2
[flag] => Yes
)
처럼 보인다하지만 난 배열이 같은 포트 값으로 병합합니다. 위의 배열에서 나는 2 개의 16,14 및 1 포트 번호가 있습니다. 그래서 그들은 같은 값으로 병합해야하고 어떤 값이 다른 경우 값 사이에 쉼표로 저장해야합니다. 결과 배열은 다음과 같아야합니다.
[0] => Array
(
[carriertype] => AWS
[radiotype] => RRUS 12 B2,RRUS 12 B4
[serialnumber] => CF82943634,CF81666912
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 16
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-7,RRU-5
[userlabletext] => 225011_1_4,225011_2_2
[flag] => Yes
)
[1] => Array
(
[carriertype] =>
[radiotype] => RRUS 12 B2
[serialnumber] => CF82961338
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 15
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-8
[userlabletext] => 225011_2_4
[flag] => Yes
)
[2] => Array
(
[carriertype] => AWS
[radiotype] => RRUS 12 B2,RRUS 12 B4
[serialnumber] => CF82943628,CF81666918
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 14
[EP_AuxPlugInUnit_AuxPlugInUnitId] => RRU-9,RRU-6
[userlabletext] => 225011_3_4,225011_3_2
[flag] => Yes
)
[3] => Array
(
[radiotype] =>
[carriertype] =>
[serialnumber] =>
[market] => Detroit Westland - DET 5
[bts] => 225011
[Host] => 225011_21_MILE_and_ROMEO_PLANK
[resourceId] => 0
[type] => XMU
[port] => 1
[EP_AuxPlugInUnit_AuxPlugInUnitId] =>
[userlabletext] => ___B,___E
[flag] => Yes
)
프로그래밍 방식으로 수행해야합니다. 도와주세요.
if ($ result [$ index] [$ key]! = "") {$ result [$ index] [$ key]. = ", $ value";} else {$ result [ $ index] [$ key]. = "$ value";} ... 그리고 작동합니다 ... 고마워요 ... 매우 도움이됩니다. –
@DivyeshJesadiya 답변에서 문제를 해결했습니다. – wazelin