问题:
创建一个遍历三维数组的递归数组函数,并根据下面的格式打印出内容。如期望的输出/目标所示,不同问题的代码是相同的。
数组:
$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>