0
0

More than 3 years have passed since last update.

phpで円をドルに換算

Posted at

【円をドル】=【換算したい円】÷【1ドル当たりの円価格】


<?php
function convert_yen_to_dollar($yen){
  $dollar_rate = 110;
  # 戻り値を指定
  return round($yen / $dollar_rate, 2);
}

# 戻り値をそのまま出力
echo '10000円は' . convert_yen_to_dollar(10000) . 'ドルです<br>';

出力結果

image.png

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