You forgot to append the date to the $date variable though and will that not display "happy New Year!" everyday before the 25th and 31st?. I never tried it so I am not sure.
onion2k wrote:As you're not changing $date your while loop will either do nothing, or run infinitely.
But, err, yeah.. Have a happy non-denominational seasonal period.
What exactly do you mean by, "As you're not changing $date your while loop will either do nothing, or run infinitely". Loops are not broken by changing elements, AFAIK???
$date is set as given. It's a very clever script as it presumes its reader knows the date and knows that $date equals the current date in textual form. Woohaaa, I should have written class, maybe
Exactly. And in patrikG's original code he wasn't changing the value of $date, so either the code wouldn't enter the while block at all, or would enter it but wouldn't ever leave, depending on the initial value of $date.. ergo: "As you're not changing $date your while loop will either do nothing, or run infinitely."
<?
$date = date('j F Y',strtotime('today'));
if($date<="31 December 2004"){
if($date<="25 December 2004") echo "Merry Christmas and a ";
echo "Happy New Year!";}
?>
Exactly. And in patrikG's original code he wasn't changing the value of $date, so either the code wouldn't enter the while block at all, or would enter it but wouldn't ever leave, depending on the initial value of $date.. ergo: "As you're not changing $date your while loop will either do nothing, or run infinitely."
patrikG wrote:$date is set as given. It's a very clever script as it presumes its reader knows the date and knows that $date equals the current date in textual form.
In short: You can watch the while loop every day, and every day $date will have increased by exactly one. Reason: it's all in our heads
/walks off with a mad giggle, gibbering in a madly hoarse voice: "Alas, the Matrix has revealed itself to me."