topical media & game development

talk show tell print

basic-regex-23-preg-match-3args.php / php



  <html>
  <head>
  <title>Using preg_match() with 3 arguments</title>
  </head>
  <body>
  <?php
  dateToday = gmdate("Y m d");
  myDate = preg_match("/(\d{4})\s(\d{2}) (\d{2})/", dateToday, dateComponents);
  if (myDate)
  {
  echo "<p>The original date was: dateToday</p>";
  echo "<p>In MM/DD/YYYY format today is: dateComponents[2]/dateComponents[3]/dateComponents[1]</p>";
  }
  ?>
  </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.