<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>判断两个时间的大小</title>
</head>

<body>
<?php
	$time1 = date("Y-m-d H:i:s");						//获取当前时间
	$time2 = "2008-8-8 20:08:08";						//给变量$time2设置一个时间
	echo "变量\$time1的时间为：".$time1."<br>";			//输出两个时间变量
	echo "变量\$time2的时间为：".$time2."<p>";
	if(strtotime($time1) - strtotime($time2) < 0){			//对两个时间进行运算
		echo "\$time1 早于 \$time2 ";					//如果time1 – time2 < 0 说明 time1的时间在前
	}else{
		echo "\$time2 早于 $time1 ";					//否则，说明time2的时间在前
	}
?>

</body>
</html>
