Days Of The Week - PHP Code help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Days Of The Week - PHP Code help

    Hi guys, I wanted help in getting the days of the week displayed as below:

    PHP Code:
    <?php
    $D
    =date("D")
    if (
    $D==sun)
    {
    echo 
    "Have a good sunday";
    }
    else if (
    $D==sat)
    {
    echo 
    "Have a good weekend";
    }
    else if (
    $D==fri)
    {
    echo 
    "Have a good day";
    }
    ?>
    and I would like it to be something like:

    Monday - echo date("D")
    Tuesday - echo date ("D") + 1
    Wednesday - echo date ("D") + 2
    etc etc.

    Thanks

    #2
    <?php
    $d=date("D");
    if ($d=="Mon") echo "Aloha Monday";
    if ($d=="Tue") echo "Hi Tuesday";
    if ($d=="Wed") echo "Hi Wen!";
    if ($d=="Thu") echo "Hi Thu!!";
    if ($d=="Fri") echo "Hi Friday";
    if ($d=="Sat") echo "Hi Saturday";
    if ($d=="Sun") echo "Hi Sunday";
    ?>
    OR JUST SEND PM

    Comment


      #3
      PHP Code:
      function greeting()
      {
      $wkdays = array('mon''tue''wed''thu''fri');
      $wkend = array('sat''sun');

      if (
      date('D') === 'Fri')
      return 
      'TGIF!';

      if (
      in_array(strtolower(date('D')), $wkdays))
      return 
      'Hello there, its '.date('l');

      return 
      'Have an awsome weekend!';

      Comment

      Working...
      X