Discuz教程网

php比较时间段一与时间段二是否有交集

[复制链接]
authicon 星火燎原 发表于 2011-6-11 08:43:33 | 显示全部楼层 |阅读模式
PHP比较时间段一与时间段二是否有交集的实现代码,需要的朋友可以参考下。
代码如下:
  1. /*
  2. *比较时间段一与时间段二是否有交集
  3. */
  4. function isMixTime($begintime1,$endtime1,$begintime2,$endtime2)
  5. {
  6. $status = $begintime2 - $begintime1;
  7. if($status>0){
  8. $status2 = $begintime2 - $endtime1;
  9. if($status2>0){
  10. return false;
  11. }else{
  12. return true;
  13. }
  14. }else{
  15. $status2 = $begintime1 - $endtime2;
  16. if($status2>0){
  17. return false;
  18. }else{
  19. return true;
  20. }
  21. }
  22. }
复制代码




上一篇:php简易聊天室代码
下一篇:Discuz X2 发帖【默认隐藏帖子】需要回复可见
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-8-2 14:55

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表