Skip to content

Instantly share code, notes, and snippets.

@ryu1-1uyr
Created February 12, 2018 07:11
Show Gist options
  • Save ryu1-1uyr/ad38381de89b3cce6da8eb68a45d3458 to your computer and use it in GitHub Desktop.
Save ryu1-1uyr/ad38381de89b3cce6da8eb68a45d3458 to your computer and use it in GitHub Desktop.
なんか回りくどい
<?php
$prices = array(1000, 650, 750, 800);
echo '$pricesの値: ';
foreach ($prices as $price) {
echo $price.' ';
}
echo '<br>';
echo '-----';
echo '<br>';
// この下にコードを書いてください
$ans = 0;
foreach($prices as $price) {
$ans += $price;
}
echo "合計金額は".$ans."円です";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment