我试图在多维数组中输出所有数据,但当我在浏览器中运行它时,我一直得到未知的错误。据我所知,我做的每件事都是正确的。我也尝试过单引号和双引号,但仍然没有成功。希望一双新鲜的眼睛能把事情弄清楚。
$goods = array(
'foods' => array(
"desert" => "chocolate cake",
"fruit" => "fuji apples",
"veggies" => "baby carrots",
"poultry" => "grilled chicken"),
'drinks' => array(
"soda" => "coca cola",
"juice" => "florida orange",
"coffee" => "black",
"beer" => "heineken"););
echo "<pre>";
foreach ($goods as $section => $items)
foreach ($items as $key => $description)
echo "$section:t$keyt($description)<br>";
echo "</pre>";
$goods = array(
'foods' => array(
"desert" => "chocolate cake",
"fruit" => "fuji apples",
"veggies" => "baby carrots",
"poultry" => "grilled chicken"),
'drinks' => array(
"soda" => "coca cola",
"juice" => "florida orange",
"coffee" => "black",
"beer" => "heineken"););
//REMOVE THAT SEMICOLON --> ^