2013-05-23 3 views
1

좋아, 그래서 내가 $unique_answer_title 여러 배열이 포함되어 있습니다. 내가 var_dump($unique_answer_title)를 사용할 때 아래 내가 무엇을 얻을 수있다 :단일 변수를 사용하여 PHP에서 어떻게 수행 할 수 있습니까?

array(4) { [0]=> string(9) "Immediate" [1]=> string(3) "Yes" [2]=> string(29) "Have a representative call me" [3]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" } array(8) { [0]=> string(9) "Immediate" [1]=> string(3) "Yes" [2]=> string(29) "Have a representative call me" [3]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [4]=> string(9) "Immediate" [5]=> string(2) "No" [6]=> string(29) "Have a representative call me" [7]=> string(111) "Biomek<sup><em>&#135;&#135;</em></sup> NX<sup>P</sup> Workstation " } array(12) { [0]=> string(9) "Immediate" [1]=> string(3) "Yes" [2]=> string(29) "Have a representative call me" [3]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [4]=> string(9) "Immediate" [5]=> string(2) "No" [6]=> string(29) "Have a representative call me" [7]=> string(111) "Biomek<sup><em>&#135;&#135;</em></sup> NX<sup>P</sup> Workstation " [8]=> string(20) "Greater than 3 years" [9]=> string(3) "Yes" [10]=> string(42) "Have a representative contact me via email" [11]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" } array(18) { [0]=> string(9) "Immediate" [1]=> string(3) "Yes" [2]=> string(29) "Have a representative call me" [3]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [4]=> string(9) "Immediate" [5]=> string(2) "No" [6]=> string(29) "Have a representative call me" [7]=> string(111) "Biomek<sup><em>&#135;&#135;</em></sup> NX<sup>P</sup> Workstation " [8]=> string(20) "Greater than 3 years" [9]=> string(3) "Yes" [10]=> string(42) "Have a representative contact me via email" [11]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [12]=> string(9) "Immediate" [13]=> string(2) "No" [14]=> string(15) "Send literature" [15]=> string(77) "Sign me up for more info on the Biomek 4000<sup>&#134;</sup>." [16]=> string(88) "Biomek<sup><em>&#135;&#135;</em></sup> Assay Workstation" [17]=> string(72) "SPRIworks Library Construction <sup>&#94;&#94;</sup>" } array(22) { [0]=> string(9) "Immediate" [1]=> string(3) "Yes" [2]=> string(29) "Have a representative call me" [3]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [4]=> string(9) "Immediate" [5]=> string(2) "No" [6]=> string(29) "Have a representative call me" [7]=> string(111) "Biomek<sup><em>&#135;&#135;</em></sup> NX<sup>P</sup> Workstation " [8]=> string(20) "Greater than 3 years" [9]=> string(3) "Yes" [10]=> string(42) "Have a representative contact me via email" [11]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [12]=> string(9) "Immediate" [13]=> string(2) "No" [14]=> string(15) "Send literature" [15]=> string(77) "Sign me up for more info on the Biomek 4000<sup>&#134;</sup>." [16]=> string(88) "Biomek<sup><em>&#135;&#135;</em></sup> Assay Workstation" [17]=> string(72) "SPRIworks Library Construction <sup>&#94;&#94;</sup>" [18]=> string(9) "Immediate" [19]=> string(2) "No" [20]=> string(30) "Have a representative visit me" [21]=> string(77) "Sign me up for more info on the Biomek 4000<sup>&#134;</sup>." } array(26) { [0]=> string(9) "Immediate" [1]=> string(3) "Yes" [2]=> string(29) "Have a representative call me" [3]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [4]=> string(9) "Immediate" [5]=> string(2) "No" [6]=> string(29) "Have a representative call me" [7]=> string(111) "Biomek<sup><em>&#135;&#135;</em></sup> NX<sup>P</sup> Workstation " [8]=> string(20) "Greater than 3 years" [9]=> string(3) "Yes" [10]=> string(42) "Have a representative contact me via email" [11]=> string(109) "Biomek<sup><em>&#135;&#135;</em></sup> FX<sup>P</sup> Workstation" [12]=> string(9) "Immediate" [13]=> string(2) "No" [14]=> string(15) "Send literature" [15]=> string(77) "Sign me up for more info on the Biomek 4000<sup>&#134;</sup>." [16]=> string(88) "Biomek<sup><em>&#135;&#135;</em></sup> Assay Workstation" [17]=> string(72) "SPRIworks Library Construction <sup>&#94;&#94;</sup>" [18]=> string(9) "Immediate" [19]=> string(2) "No" [20]=> string(30) "Have a representative visit me" [21]=> string(77) "Sign me up for more info on the Biomek 4000<sup>&#134;</sup>." [22]=> string(9) "Immediate" [23]=> string(2) "No" [24]=> string(5) "Other" [25]=> string(88) "Biomek<sup><em>&#135;&#135;</em></sup> Assay Workstation" }

어떻게 하나 개의 숫자 배열로 아래 그림이 배열의 모든 요소를 ​​결합 할 수 있습니다?

array_merge($unique_answer_title)은 작동하지 않는 것 같습니다 ... 그리고 변수 $unique_answer_title 자체는 배열이 아니며 다중 배열 그룹입니다. 어떻게이 모든 개별 배열의 요소를 하나의 큰 배열로 모을 수 있습니까?

+0

흠이,이 질문은 좀 다른 질문을 생각 나게한다, 나를 보자 ... – hakre

+0

아, 여기있다 : http://stackoverflow.com/questions/16723700/how-can-i-merge-multiple 배열에 포함되지 않는 배열 - 이제는 저품질 질문을 downvoting하고 닫기/삭제 투표를합니다. 당신은이 도움 - 뱀파이어 물건을 좋아하는 것처럼 보이므로 나는 당신을 중재자에게 직접 기표합니다. – hakre

답변

1

foreach 루프에서 단일 배열을 병합해야합니다.

$mergedArray = array(); 
foreach($unique_answer_title as $single){ 
    $mergedArray = array_merge($mergedArray, $single); 
} 
+0

$ unique_answer_title에 배열이 여러 개 포함되어 있습니다. 배열 자체가 아닙니다. 왜 반복할까요? ??? – user1787184

+0

그것은 작동하지 않습니다. 이것은 내가 얻는 것입니다. 경고 : array_merge() : 인수 2는 C : \ xampp \ htdocs \ tms \ _reports \ lead_synopsis.php의 배열 730 – user1787184

+0

에 코드를 추가 할 수 있습니까? $ unique_answer_title이 정의 되었습니까? 단일 var_dump 호출 또는 루프/다중 호출에서 var_dump의 출력 이었습니까? –

관련 문제