有人请帮助我纠正此代码中的错误。这是我尝试查找库存冰淇淋名称的代码。
<?php
$flavors = array();
$flavors[]=array("name" => "CD" , "in_stock" => true);
$flavors[]=array("name" => "V" , "in_stock" => true);
$flavors[]=array("name" => "S" , "in_stock" => false);
foreach($flavors as $flavor => $value) {
if($flavor["in_stock"] == true) {
echo $flavor["name"] . "\n";
}
}
?>
精慕HU
慕码人8056858