I dump an array that shows the following:
Array (9) {[0] = = Array (6) {["que_content"] = = string (one) "11111111111" ["que_id"] = + string (1) "1" [" Ops_qid "] + string (1)" 1 "[" ops_contentoid "] = + string (1)" A "[" ops_content "] + string (+)" aaaaaaa111111 1 "[" ops_count "] = + string (1)" 3 "} [1] = = Array (6) {[" Que_content "] and string (one)" 11111111111 "[" Qu e_id "] = string (1)" 1 "[" ops_qid "] = + string (1)" 1 "[" ops_contentoid "] + string (1)" B "[" Ops_content "] = = String (Ten) "BBBBBBBBBB" ["ops_count"] + = string (1) "1"} [2] = = Array (6) {["que_content"] = Stri Ng (one) "11111111111" ["que_id"] + string (1) "1" ["ops_qid"] = = string (1) "1" ["ops_contentoid"] = Stri Ng (1) "C" ["ops_content"] + = string (8) "CCCCCCCC" ["ops_count"] = = string (1) "1"} [3] = = Array (6) {[ "Que_content"] = + string (9) "222222222" ["que_id"] = + string (1) "2" ["ops_qid"] = + string (1) "2" ["Ops_c Ontentoid "] = = string(1) "D" ["ops_content"] + = string (9) "DDDDDDDDD" ["Ops_count"] + string (1) "3"} [4] = = Array (6) {[" Que_content "] + string (9)" 222222222 "[" que_id "] = + string (1)" 2 "[" ops_qid "] = + string (1)" 2 "[" Ops_co Ntentoid "] + string (2)" EF "[" Ops_content "] and" EFE2EFEF2FEF "[" ops_count "] = + string (1)" 1 "} [5] = = Array (6) {["que_content"] = + string (9) "222222222" ["que_id"] + = string (1) "2" ["Ops_qid"] =&G T String (1) "2" ["ops_contentoid"] + = string (1) "F" ["ops_content"] + = string (+) "Fff32fffffffff" ["Ops_coun T "] = string (1)" 1 "} [6] = = Array (6) {[" que_content "] + string (9)" 333333333 "[" que_id "] = = string (1) "3" ["ops_qid"] = + string (1) "3" ["Ops_contentoid"] + string (2) "GG" ["ops_content"] + string (13) "GGG323GGGGGGG" ["ops_count"] = + string (1) "1"} [7] = = Array (6) {["que_content"] + = string (9) "33333333 3 "[" que_id "] => String (1) "3" ["ops_qid"] + = string (1) "3" ["Ops_contentoid"] + string (1) "H" ["ops_content"] = = string (Ten) "Hhh5h5h5h5" ["Ops_count"] + string (1) "2"} [8] = = Array (6) {["que_content"] + string (9) "333333 333 "[" que_id "] + = string (1)" 3 "[" ops_qid "] = + string (1)" 3 "[" ops_contentoid "] = = string (1)" J "[" O Ps_content "] = = string (8)" J8j8j8j8 "[" ops_count "] + = string (1)" 2 "}}
I want to output this way output, what should I do?
Question: 11111111111 options: A content: aaaaaaa1111111 option: B content: BBBBBBBBBB option: C content: CCCCCCCC problem: 222222222 option: D Content: ddddddddd options: EF content: EFE2EFEF2FEF option: F content: Fff32fffffffff question: 333333333 options: GG content: GGG323GGGGGGG option: H Content: Hhh5h5h5h5 options: J content: j8j8j8j8
Reply to discussion (solution)
Just got out of your look:
foreach ($a as $v) { if ($qid! = $v [' ops_qid ']) {echo ' question: '. $v [' que_content ']. "
"; $qid = $v [' ops_qid ']; } else{ echo ' option: '. $v [' ops_contentoid ']. ' Content '. $v [' ops_content ']. "
"; }}
Seems to be slightly altered:
The code is as follows:
foreach ($a as $v) { if ($qid! = $v [' ops_qid ']) { echo ' question: '. $v [' que_content ']. "
"; echo ' option: '. $v [' ops_contentoid ']. ' Content '. $v [' ops_content ']. "
"; $qid = $v [' ops_qid ']; } else{ echo ' option: '. $v [' ops_contentoid ']. ' Content '. $v [' ops_content ']. "
"; }}
if ($qid! = $v [' ops_qid '])
What does $qid mean?
$qid is a temporary variable that holds the previous round of ops_qid. So you can check to see if it's a new problem.
To nowphp
Why do you want to change to #2 appearance, will #1 of else delete it is OK?
$qid is a temporary variable that holds the previous round of ops_qid. So you can check to see if it's a new problem.
To nowphp
Why do you want to change to #2 appearance, will #1 of else delete it is OK? Yes, yes, moderator carefully, I was careless.