(Moved to Code Review, where this belongs).
I have an event recurring on the first friday of the month (at 7pm), and I need to output the date of the next first friday coming up.
This is the first bit of PHP I've written, and I was wondering if there is a better way to implement this? Server is running PHP 5.3
Here's what I wrote:
$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';
}