開発環境
- OS X Lion - Apple(OS)
- Apache (Web Server)
- PHP (サーバーサイドプログラミング言語)
- TextWrangler(Text Editor) (BBEditの無料機能制限版、light版)
『初めてのPHP5』 (David Sklar 著、 桑村 潤 翻訳、 廣川 類 翻訳、 オライリー・ジャパン、2005年、ISBN978-4-87311-257-2)の2章(テキストと数の操作)2.5(演習問題)2を解いてみる。
2
コード(TextWrangler)
<?php $humberger = 4.95; $chocolate = 1.95; $cola = 0.85; $tax_per = 0.075; $tip_per = 0.16; $total = $humberger * 2 + $chocolate + $cola; $tax = $total * $tax_per; $tip = $total * $tip_per; $result = $total + $tax + $tip; print "合計: \${$result}\n"; ?>
HTMLソース
合計: $15.6845
0 コメント:
コメントを投稿