情報処理実習3B(Web)

2017年度 前期 木04 15:15-16:45 瀬田2-119

課題

02.variable/var3.php

表示
ソース

<?php
date_default_timezone_set('Asia/Tokyo');
$today_date = date("d");  //文字列型
$today_month = date("m"); //文字列型
$today_year = date("Y");  //文字列型
?>
<!DOCTYPE html>
<html lang="ja">
<head>
   <meta charset="UTF-8" />
   <title>データの型</title>
</head>
<body>
<?php
print '<p>今日は'.$today_year.'年'.$today_month.'月'.$today_date.'日です(today_monthはこの段階では文字列型)</p>';
print '<p>一ヶ月後は'.$today_year.'年'.$today_month.'月'.$today_date.'日です(today_monthは数値型に変換される)</p>';
?>
<!--上記計算は暫定的なもので正しいものではない(12月の次は13月になる)-->
</body>
</html>