我有这个数组
[multiv] => Array
(
[31603] => Array
(
[0] => one
[1] => two
[2] => three
[3] => four
)
[18992] => Array
(
[0] => five
[1] => six
[2] => seven
[3] => eight
)
)
我想使用标签一起显示它的所有元素和每个数组键。article
我有这个
foreach( $main_array['multiv'] as $key => $value ) {
foreach( $value as $k => $v ) {
echo "
<article class='crud_list'>
<input type='hidden' name='$key' />
<input type='text' name='$k' value='$v' /><br/>
<input type='checkbox' name='$k' value='$v' /><br/>
<input type='radio' name='$k' value='$v' /><br/>
<select><option>$k</option></select><br/>
</article>
";
}
}
但问题是代码总共输出了八个article
标签。第一个foreach
获取顶部数组的数组键,但是我该如何获取一个值0,1,2,3
,article
这样现在我将只有两个文章标签用于数组?