1.00, "onion" => .50),"fruit" => array("apple" => 2.50, "orange" => 2.00));foreach($food">
时间:2021-07-01 10:21:17 帮助过:43人阅读
$foodPrices = array(
"vegetable" => array("potato" => 1.00, "onion" => .50),
"fruit" => array("apple" => 2.50, "orange" => 2.00)
);
foreach($foodPrices as $category)
{
foreach($category as $food => $price);
{
$f_price = sprintf("%01.2f", $price);
echo "$food: \$$f_price
";
}
}
?>