从2000年1月1日开始“三天打渔,两天晒网”算,求任意一天打渔还是晒网?该如何处理

WBOY
Release: 2016-06-13 13:31:23
Original
1007 people have browsed it

从2000年1月1日开始“三天打渔,两天晒网”算,求任意一天打渔还是晒网?
从2000年1月1日开始“三天打渔,两天晒网”算,求任意一天打渔还是晒网?

------解决方案--------------------

PHP code
<?php $s=strtotime('2000-1-1');
$time=strtotime('2012-5-11');
$sum=($time-$s)/86400;
$day=$sum%5;
echo $day<=3?'打渔':'晒网';
<br /><font color="#e78608">------解决方案--------------------</font><br>写个函数了。<br><br>
Copy after login
PHP code

function GetText($day)
{
    $nowDay = date("z", strtotime($day)) + 1;
    Return ($nowDay%5 >= 1 && $nowDay%5 <font color="#e78608">------解决方案--------------------</font><br>计算的不准是因为天数差计算有误<br><br>给个最笨的方法,供你参考。你不是在做作业吗?<br><br>$t = strtotime('2000-1-1');<br>$i = 0;<br>while($t  echo date('Y-m-d', $t) . ' '. ($i  $t = strtotime('+1 day', $t);<br> $i = ($i+1) % 5;<br>}<br> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
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 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!