マルチ次元PHPに私の配列を変換することができ、私は私の配列は以下のようになりたい多次元配列はどのように私はこれが私の現在の配列です
Array
(
[question1] => My question 1
[options1] => My Option 1
[answer1] => Answer 1 goes here
[question2] => My question 2
[options2] => My Option 2
[answer2] => Answer 2 goes here
)
にこの配列を変換したいです。どのようにこれを達成することができます、任意の提案?ここで
Array
(
[0] => Array
(
[question1] => My question 1
[options1] => My Option 1
[answer1] => Answer 1 goes here
)
[1] => Array
(
[question2] => My question 2
[options2] => My Option 2
[answer2] => Answer 2 goes here
)
)
は私のコード
$i=9;
$topicsArr=array();
$j = 1;
while ($row[$i]){
$topicsArr['question' .$j] = $row[$i];
$topicsArr['options' .$j] = $row[$i+1];
$topicsArr['answer' .$j] = $row[$i+2];
$i = $i +3;
$j++;
}