(これが属するコードレビューに移動しました)。
その月の第1金曜日(午後7時)に定期的なイベントがあり、次の第1金曜日の日付を出力する必要があります。
これは私が書いたPHPの最初のビットであり、これを実装するためのより良い方法があるかどうか疑問に思っていました。サーバーはPHP5.3を実行しています
これが私が書いたものです:
$d = strtotime('today');
$t = strtotime('first friday of this month');
if ($d > $t) {
$ff = strtotime('first friday of next month');
$ffn = date('M j', $ff);
echo 'Friday, '.$ffn.' at 7pm';
} elseif ($d == $t) {
echo 'Tonight at 7pm';
} else {
$ff = strtotime('first friday of this month');
$fft = date('M j', $ff);
echo 'Friday, '.$fft.' at 7pm';
}