Home > php教程 > php手册 > body text

php根据日期或时间戳获取星座信息和生肖等信息

WBOY
Release: 2016-06-06 19:41:09
Original
1131 people have browsed it

这篇文章主要介绍了php根据日期或时间戳获取星座信息和生肖等信息的相关资料,需要的朋友可以参考下

分享一个利用php根据日期或时间戳获取相应的干支纪年,生肖和星座信息的函数方法,具体函数代码以及使用方法如下:

/** 判断干支、生肖和星座 */ function birthext($birth){ if(strstr($birth,'-')===false&&strlen($birth)!==8){ $birth=date("Y-m-d",$birth); } if(strlen($birth)===8){ if(eregi('([0-9]{4})([0-9]{2})([0-9]{2})$',$birth,$bir)) $birth="{$bir[1]}-{$bir[2]}-{$bir[3]}"; } if(strlen($birth)=$zone[0]||(100*$m+$d)=$zone[$i]&&(100*$m+$d)

 使用实例如下:

'; $arr=birthext('1373287361'); //时间戳 print_r($arr); $arr=birthext('2013-07-08'); print_r($arr); $arr=birthext('20130708'); print_r($arr);

打印结果如下:

php根据日期或时间戳获取星座信息和生肖等信息

以上就是关于php根据日期或时间戳获取星座信息和生肖等信息的函数方法,希望对大家的学习有所帮助。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!