Re: [請益] 請教一個日期條件設計問題

作者: giacch   2018-01-23 11:51:08
(原文恕刪)
只是練習...
PHP Sandbox: http://tinyurl.com/y86rmvqf
<?php
$birthday="1911-01-03";
$birthday_m=date("m", strtotime($birthday));
$now_m=date("m");
//$birthday_m="02";
//$now_m="12";
echo "birthday_m: ".$birthday_m."\n";
echo "now_m: ".$now_m."\n";
echo "fmod($now_m + 1, 12): ".fmod($now_m + 1, 12)."\n";
echo "fmod($birthday_m, 12): ".fmod($birthday_m, 12)."\n";
if ($now_m == $birthday_m
|| fmod($now_m + 1, 12) == fmod($birthday_m, 12)) {
echo "您有生日優惠。"."\n";
}
作者: lusaka (gary.lusifa)   2018-01-23 13:50:00
感謝您的分享

Links booklink

Contact Us: admin [ a t ] ucptt.com