我有一个数组,我想得到我认为的数组数组的值。但我无法获得所有数组值的值。所以请告诉我哪种方式可以获得所有值。
print_r($demo);
Array ( [] => Array ( [0] => research , monitoring , benchmarking )
[1] => Array ( [0] => online marketing software )
[2] => Array ( [0] => online exposure )
[3] => Array ( [0] => research , monitoring , benchmarking )
[4] => Array ( [0] => research , monitoring , benchmarking )
[5] => Array ( [0] => Internet Marketing platform providing research , monitoring , benchmarking & ; recommendations - )
[6] => Array ( [0] => research monitoring benchmarking )
[7] => Array ( [0] => online marketing )
[8] => Array ( [0] => online exposure )
[9] => Array ( [0] => Online Marketing )
[10] => Array ( [0] => online exposure )
[11] => Array ( [0] => marketing software )
[12] => Array ( [0] => Internet Marketing platform providing research monitoring benchmarking amp recommendations )
[13] => Array ( [0] => Learn how )
[14] => Array ( [0] => rough seas )
[15] => Array ( [0] => tools empowering you )
[16] => Array ( [0] => complex take control )
[17] => Array ( [0] => tools you need )
[18] => Array ( [0] => achieve results )
[19] => Array ( [0] => criticone online intelligence )
[20] => Array ( [0] => gain knowledge amp drive business results )
[21] => Array ( [0] => 60 seconds View )
[22] => Array ( [0] => plans Questions 1300 664 )
[23] => Array ( [0] => 1 website )
[24] => Array ( [0] => numerous microsites )
[25] => Array ( [0] => Author images )
[26] => Array ( [0] => author images )
[27] => Array ( [0] => 1300 664 )
[28] => Array ( [0] => Learn how )
[29] => Array ( [0] => rough seas )
[30] => Array ( [0] => tools empowering you )
[31] => Array ( [0] => complex , take control )
[32] => Array ( [0] => tools you need )
[33] => Array ( [0] => achieve results )
[34] => Array ( [0] => ..,Leverage criticone online intelligence )
[35] => Array ( [0] => gain knowledge & ; drive business results )
[36] => Array ( [0] => 60 seconds View )
[37] => Array ( [0] => plans Questions 1300 664 )
[38] => Array ( [0] => 550,Why 1 )
[39] => Array ( [0] => numerous microsites )
[40] => Array ( [0] => Author images ) )
criticone
答案 0 :(得分:0)
您可以“直接”访问它:
echo $demo[2][0]; // "online exposure"
或者,如果您需要遍历所有或几个元素,请使用foreach循环:
foreach ($demo as $key => $subarr)
{
if ($key > 5)
{
echo $subarr[0];
}
}
从数组索引6向上打印所有值。
注意:这些只是(非常愚蠢的)示例,用于说明如何处理多维数组。还有更多的方法来处理它们,这些只是(对我而言)两个最自然的方式。希望它有所帮助。