私はあなたが何を意味するのか完全にはわかりませんが、これは私があなたが望むと思うことをするはずです:
$time1 = strtotime("first Monday of {$monthname} {$year}");
$time2 = strtotime("third Monday of {$monthname} {$year}");
echo date('jS F Y', time() > $time1 ? $time2 : $time1); // e.g. 1st January 1970
time() > $time1 ? $time2 : $time1は、基本的に次を意味する三項条件です。
condition ? if_true : if_false
あなたが書いたように、変数を二重引用符で囲むことができることを知っておく必要があると思います。
$a = 'first';
echo "The $a day of the week"; // echoes 'The first day of the week
ただし、単一引用符ではなく、たとえば
$a = 'first';
echo 'The $a day of the week'; // echoes 'The $a day of the week.
私ができるように、慣習から外れた変数の周りに中括弧を置きます
$a = 'first';
$b = 'variable';
echo "This is the {$a}_{$b}"; // Echoes 'This is the first_variable'
ブレースなし
echo "This is the $a_$b" // Undefined variable $a_
また
try {
// Do something
} catch (Exception $ex) {
echo "There was an error and the message was {$ex->getMessage()}";
}