開発環境
- OS X Lion - Apple(OS)
- Apache (Web Server)
- PHP (サーバーサイドプログラミング言語)
- TextWrangler(Text Editor) (BBEditの無料機能制限版、light版)
『初めてのPHP5』 (David Sklar 著、 桑村 潤 翻訳、 廣川 類 翻訳、 オライリー・ジャパン、2005年、ISBN978-4-87311-257-2)の3章(判定と繰り返しについて)3.6(演習問題)4を解いてみる。
4.
HTML、PHPのソースコード(TextWrangler)
<style>
table{
table-layout:fixed; width: 200px;
}
td{
text-align:right;
}
</style>
<?php
print '<table border=1>';
print '<caption>華氏と摂氏の温度の値の表</caption>';
print '<tr><th>華氏</th><th>摂氏</th></tr>';
for($f = -50; $f <= 50; $f += 5){
printf("<tr><td>%d</td><td>%.2f</td></tr>", $f, ($f - 32) * 5 / 9);
}
print '</table>';
?>
0 コメント:
コメントを投稿