LoginSignup
0
0

More than 3 years have passed since last update.

PHPで変数を使う

Posted at

PHPで変数を用いる方法を解説

1<?php $sum = 100+1050+200; ?>

(1の説明)$sumに計算したいものを入れます(PHPでは変数にドル記号を用いる)

2合計金額は:<?php print($sum); ?>円です

(2の説明)合計金額は1の時に$に入れた計算式をprint($sum)で呼び出す

3税込価格は:<?php print($sum*1.10); ?>円です

(3の説明)税込金額ではprint($sumに1.10をかけるアスタリスク*を用いる)

上記の結果はブラウザで以下のようになる

合計金額は:1350円です
税込価格は:1485円です

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0