我有这个数组:
Array
(
[USA] => Array
(
[0] => Array
(
[Name] => Apple
[Item] => Phones and Computers
)
[1] => Array
(
[Name] => McDonalds
[Item] => Food
)
)
[China] => Array
(
[0] => Array
(
[Name] => Lenovo
[Item] => Computers
)
)
)
我想介绍一下它,并回显count每个国家(美国和中国)的商品。
所以我的尝试是这样的:
foreach ($arr as $key => $value) {
echo count($arr[$value]);
echo '<br />';
foreach ($value as $subkey => $subvalue) {
echo $value." -> ".$subvalue['Name']." make ".$subvalue['Item']."<br />";
}
}
ABOUTYOU