Seasons Greetings

Where we keep all the boring tidbits about the PHPDN site, the news, and what not.

Moderator: General Moderators

Jackdaw
Forum Newbie
Posts: 7
Joined: Thu Mar 06, 2003 2:23 pm

Post by Jackdaw »

kenrbnsn wrote:So, here's a version that works, no infinate loop, date is set, spacing is correct, etc... :D

Code: Select all

<?
$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!";}
?>
I'm not sure if I'm missing the point entirely here but this definitely makes a little more sense to me than PatrickG's original code (BTW - nice code Patrick and Happy Holodays to all back home! - the code certainly has thrown the cat among the pigeons)

I've modified this just slighly - as there exists a period of time between the 25th December and 31st December when the original message becomes outdated. So try this:

<?
$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!";}
else
{echo "Happy New Year!";}
?>


Merry Christamas everyone

- Jackdaw
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

LOL :lol:

In any event, have a Merry Christmas, and a Happy New Year.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Code: Select all

&lt;?php
$date = date('j F Y',strtotime('today'));
if($date&lt;=&quote;31 December 2004&quote;){
     echo &quote;Dear DevNetwork Fellas,\n\n&quote;;
     if($date&lt;=&quote;25 December 2004&quote;) {
         echo &quote;Let the Christmas make people believe that it is still worthwhile to live one new year. &quote;;
         echo &quote;I Wish you all a Merry Christmas and&quote;;
     }
     else
         echo &quote;Let's fullfill our hearts with love, peace and compassion! I Wish you all&quote;;
     echo &quote; a Happy New Year!&quote;;
}
?&gt;
Keep the good will, the joy and programming!

Scorphus.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

scorphus wrote:

Code: Select all

$date = date('j F Y',strtotime('today'));
You don't need strtotime('today'). date() defaults to the current date if you leave the second argument blank.

Merry Wintertide.
User avatar
Pointybeard
Forum Commoner
Posts: 71
Joined: Wed Sep 03, 2003 7:23 pm
Location: Brisbane, AUS
Contact:

Post by Pointybeard »

you mean theres a date() function? and whats this 'PHP' everyone keeps talking about? Happy new year all...
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Code: Select all

<?php
    $w='!samtsirhc yrrem';header(
  strrev('nialp/txet :epyt-tnetnoC'))
 ;$l=20;for($q=0;$q<20;$q++){for($i=0;
 $i<($l-$q)/2;$i++) {echo chr(32);}for(
 $i=0;$i<$q;$i++){echo '=';}echo chr(
10);}for($i=6;$i<14;$i++){echo chr(32);}
echo '==='.chr(10);for($i=6;$i<14;$i++)
   {echo chr(32);}echo '==='.chr(10);
   for($i=6;$i<14;$i++){echo chr(
      32);}echo '==='.chr(10);$w.=
        ' a uoy sehsiw feZ'.chr(10);
          echo strrev($w);?>
http://www.zefhemel.com/christmas.php
Image Image
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ahhh.. the fun of obfuscation and ascii art.. :P
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

What else could you expect? Traditional Chistmas greeting post on a scripting form.

75% conversation about scripting that will most likely never be appied on a website other than for decoratorive purposes.
25% actual merry wishes

Since I'm late because I have been working lots lately:

Merry belated Christmass and Happy belated new years! :lol:
Post Reply