array("ジャガイモ" => 1.00, "玉ねぎ" => .50), 「果物」="/> array("ジャガイモ" => 1.00, "玉ねぎ" => .50), 「果物」=">
2维数组为什么只输出一个?
<br /> <?php<br /> <br /> $foodPrices = array(<br /> "vegetable" => array("potato" => 1.00, "onion" => .50),<br /> "fruit" => array("apple" => 2.50, "orange" => 2.00)<br /> );<br /> <br /> foreach($foodPrices as $category)<br /> {<br /> foreach($category as $food => $price);<br /> {<br /> $f_price = sprintf("%01.2f", $price);<br /> echo "$food: \$$f_price <br>";<br /> }<br /> }<br /> ?><br />