switch语句的例子!
<?php
/**
* QQ:5871029 Email:hel8@vip.qq.com
* @copyright Horleun (c)2010
* @author Horleun <Horleun@foxmail.com>
*/
switch(date(“D”))//D注意大小写
{
case “Mon”://””里面首字母是大写的.
echo”Today is Monday.”;
break;//要用break跳出.
case “Tue”:
echo”Today is Tuesday.”;
break;
case”Wed”:
echo”today is wednesday”;
break;
case”Thu”:
echo”today is thursday.”;
break;
case”Fri”:
echo”Today is Friday”;
break;
default:
echo”today is wenkend!!”;
break;
}
?>
今天是4月21日,星期四!
下面看结果吧~