【发布时间】:2016-12-01 09:59:20
【问题描述】:
我想遍历下面的数组。
array(2) {
[0]=> array(6) {
[0]=> string(10) "excel_id "
[1]=> string(12) "excel_name "
[2]=> string(11) "excel_email"
[3]=> string(13) "excel_address"
[4]=> string(12) "excel_giveby"
[5]=> string(16) "excel_accesories"
}
[1]=> array(6) {
[0]=> float(111)
[1]=> string(10) "sh1exname1"
[2]=> string(11) "sh1exemail1"
[3]=> string(12) "sh1exaddress"
[4]=> string(12) "sh1exgivenby"
[5]=> string(16) "sh1exaccesorries"
}
}
谁能帮帮我?
【问题讨论】:
-
尝试在开始时使用
foreach循环 -
提问前请查看这里:stackoverflow.com/help/how-to-ask
-
您是否尝试过查看有关数组的 PHP 手册?
-
这与在任何其他编程语言中遍历大小为 2X6 的二维数组相同。使用两个循环并遍历整个数组。
-
foreach ($data as $innerArray) { if (is_array($innerArray)){ // 扫描内循环 foreach ($innerArray as $value) { var_dump($value); } }else{ 回声 $innerArray; } }
标签: php multidimensional-array