topical media & game development

talk show tell print

basic-regex-23-replaceDemo.php / php



  <html>
  <head>
  <title>A preg_replace() Demo</title>
  </head>
  <body>
  <?php
  myString = "Star Training Company.";
  newString = preg_replace("/Star/", "Moon", myString);
  echo "<p>The original string was: 'myString'.</p>";
  echo "<p>After replacement the string is: 'newString'.</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.