php值班系统,php简单的值日值班处理方法

$array=array('张三','李四','王五');$days=timeList(time(),strtotime('20150206000000'));foreach($days['dayList'] as $k=>$v){

if(($k+1)%3==1){ $res[$v]=$array[0];}

if(($k+1)%3==2){ $res[$v]=$array[1];}

if(($k+1)%3==0){ $res[$v]=$array[2];}

}

echo "

";print_r($res);exit;function timeList($beginTimeStamp,$endTimeStamp){

if(!is_numeric($beginTimeStamp)||!is_numeric($endTimeStamp)||($endTimeStamp<=$beginTimeStamp)) return '';$tmp=array();for($i=$beginTimeStamp;$i<=$endTimeStamp;$i+=(24*3600)){

$tmp['dayList'][]=date('Y年m月d日',$i);}

return $tmp;}

/***

结果

Array

(

[2014年12月19日] => 张三

[2014年12月20日] => 李四

[2014年12月21日] => 王五

[2014年12月22日] => 张三

[2014年12月23日] => 李四

[2014年12月24日] => 王五

[2014年12月25日] => 张三

[2014年12月26日] => 李四

[2014年12月27日] => 王五

[2014年12月28日] => 张三

[2014年12月29日] => 李四

[2014年12月30日] => 王五

[2014年12月31日] => 张三

[2015年01月01日] => 李四

[2015年01月02日] => 王五

[2015年01月03日] => 张三

[2015年01月04日] => 李四

[2015年01月05日] => 王五

[2015年01月06日] => 张三

[2015年01月07日] => 李四

[2015年01月08日] => 王五

[2015年01月09日] => 张三

[2015年01月10日] => 李四

[2015年01月11日] => 王五

[2015年01月12日] => 张三

[2015年01月13日] => 李四

[2015年01月14日] => 王五

[2015年01月15日] => 张三

[2015年01月16日] => 李四

[2015年01月17日] => 王五

[2015年01月18日] => 张三

[2015年01月19日] => 李四

[2015年01月20日] => 王五

[2015年01月21日] => 张三

[2015年01月22日] => 李四

[2015年01月23日] => 王五

[2015年01月24日] => 张三

[2015年01月25日] => 李四

[2015年01月26日] => 王五

[2015年01月27日] => 张三

[2015年01月28日] => 李四

[2015年01月29日] => 王五

[2015年01月30日] => 张三

[2015年01月31日] => 李四

[2015年02月01日] => 王五

[2015年02月02日] => 张三

[2015年02月03日] => 李四

[2015年02月04日] => 王五

[2015年02月05日] => 张三

)

**/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值