topical media & game development

talk show tell print

basic-php-02-date.php / php



  <html>
  <head>
  <title>How many days in this month?</title>
  </head>
  <body>
  <?php
  month = date("n");
  if (month==1) echo "31";
  if (month==2) echo "28 (unless it's a leap year)";
  if (month==3) echo "31";
  if (month==4) echo "30";
  if (month==5) echo "31";
  if (month==6) echo "30";
  if (month==7) echo "31";
  if (month==8) echo "31";
  if (month==9) echo "30";
  if (month==10) echo "31";
  if (month==11) echo "30";
  if (month==12) echo "31";
  ?>
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.