PHP根据生日/日期取得星座的函数
PHP #星座 #函数2012-06-12 20:42
以下是函数代码:
//取得星座
function getConstellation($date){
$month=substr($date,5,2); //取出月份
$day=substr($date,8,2); //取出日期
switch($month){
case "01":
if($day<21){$res='魔羯';}else{$res='水瓶';} break;
case "02":
if($day<20){$res='水瓶';}else{$res='双魚';} break;
case "03":
if($day<21){$res='双魚';}else{$res='牧羊';} break;
case "04":
if($day<20){$res='牧羊';}else{$res='金牛';} break;
case "05":
if($day<21){$res='金牛';}else{$res='双子';} break;
case "06":
if($day<22){$res='双子';}else{$res='巨蟹';} break;
case "07":
if($day<23){$res='巨蟹';}else{$res='獅子';} break;
case "08":
if($day<23){$res='獅子';}else{$res='处女';} break;
case "09":
if($day<23){$res='处女';}else{$res='天秤';} break;
case "10":
if($day<24){$res='天秤';}else{$res='天蠍';} break;
case "11":
if($day<22){$res='天蠍';}else{$res='射手';} break;
case "12":
if($day<22){$res='射手';}else{$res='魔羯';} break;
}
return $res;
}相关文章
- 用php谈SQL注入攻击与XSS攻击 2012/06/11
- 说说PHP抽象类 2012/06/11
- php实现IOS消息推送的代码 2012/06/08
- PHP有干扰线噪点的验证码类 2012/06/06
- PHP短链接算法 2012/06/04
- php用curl smtp发送邮件 2012/06/04
- php隐藏图片真实地址的代码 2012/06/04
- 在windows下定时执行PHP的方法 2012/06/04
- PHP实现京东API的授权HASH算法 2012/06/03
- PHP正则验证邮箱的函数 2012/06/03