Home >Backend Development >PHP Tutorial >PHP获取某一年所有的周六日期

PHP获取某一年所有的周六日期

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:33:461447browse

直接贴代码:

<?php$first_Sat=date('Y-m-d',strtotime('this Saturday',strtotime("2015-01-01")));$Sat=array($first_Sat);for($i=0;;$i+=7){    $current_time=strtotime($i.' days',strtotime($first_Sat));    if($current_time>strtotime('2015-12-31')){        break;    }    $Sat[]=date('Y-m-d',$current_time);}var_dump($Sat);

代码书写格式,以及效率方面,自己去优化

Statement:
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