問題:
3 次元配列をウォークスルーする再帰配列関数を作成し、以下の形式に従って内容を出力します。目的の出力/目標に示されているように、さまざまな質問のコードは同じです。
配列:
$items = array (
'What is your gender?' => array
(
'gender' => array
(
'1' => 'Man',
'2' => 'Woman'
)
),
'What is your education?' => array
(
'education' => array
(
'1' => 'Elementary school',
'2' => 'Middle school',
'3' => 'High school',
'4' => 'Post-secondary education (BSc, MSc)',
'5' => 'Advanced education (PhD)'
)
)
);
望ましい出力/目標:
<div class="control-group">
<label class="control-label"><strong>What is your gender?</strong></label>
<div class="controls">
<label class="radio">
<input type="radio" name="gender" id="gender" value="1" checked>
Man
</label>
<label class="radio">
<input type="radio" name="gender" id="gender" value="2">
Woman
</label>
</div>
</div>
<div class="control-group">
<label class="control-label"><strong>What is your education?</strong></label>
<div class="controls">
<label class="radio">
<input type="radio" name="education" id="education" value="1" checked>
Elementary school
</label>
<label class="radio">
<input type="radio" name="education" id="education" value="2">
Middle school
</label>
<label class="radio">
<input type="radio" name="education" id="education" value="3">
High school
</label>
<label class="radio">
<input type="radio" name="education" id="education" value="4">
Post-secondary education (BSc, MSc)
</label>
<label class="radio">
<input type="radio" name="education" id="education" value="5">
Advanced education (PhD)
</label>
</div>
</div>