Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP在数字数组中打印关联数组_Php_Loops_Multidimensional Array - Fatal编程技术网

使用PHP在数字数组中打印关联数组

使用PHP在数字数组中打印关联数组,php,loops,multidimensional-array,Php,Loops,Multidimensional Array,我有一个数字数组,每一行都是一个关联数组。此阵列上的var_转储类似于: array (size=4) 0 => array (size=1) 'brand' => string 'Daewoo' (length=6) 1 => array (size=1) 'brand' => string 'Honda' (length=5) 2 => array (size=1) 'brand' => string 'Mazda' (len

我有一个数字数组,每一行都是一个关联数组。此阵列上的var_转储类似于:

array (size=4)
  0 => 
array (size=1)
  'brand' => string 'Daewoo' (length=6)
  1 => 
array (size=1)
  'brand' => string 'Honda' (length=5)
  2 => 
array (size=1)
  'brand' => string 'Mazda' (length=5)
我如何在这个多维数组中循环以在选择/选项中显示关键品牌的价值

我尝试了类似于for循环的东西,里面有一个foreach循环,但我的关联数组没有名称,它没有声明为变量

有什么想法吗?

这个怎么样:

foreach ($numerical_array AS $row) {
  print ("<option>" . $row['brand'] . "</option>");
}

谢谢你的帮助,我不知道这个函数。谢谢你的回答。我总是在数值数组中使用for循环,在关联数组中使用foreach循环,但我不知道我可以这样使用它。