<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>else if语句的应用</title>
</head>

<body>
<?php
	$moth = date("n");								//设置月份变量$moth
	$today = date("j");								//设置日期变量$today
	if ($today >= 1 and $today <= 10){				//判断日期变量是否在1-10之间
		echo "今天是".$moth."月".$today."日上旬";	//如果是，说明是上旬
	}elseif($today > 10 and $today <= 20){			//否则判断日期变量是否在11-20之间
		echo "今天是".$moth."月".$today."日中旬";	//如果是，说明是中旬
	}else{											//如果上面两个判断都不符合要求，则输出默认值
		echo "今天是".$moth."月".$today."日下旬";	//说明是本月的下旬
	}
?>

</body>
</html>
