<html>
<head>
<title>Regex Test</title>
</head>
<body bgcolor=lightyellow>
<h1><center>Regex Replace</center></h1>
<?php
$string = 'hello world hello';
print 'Starting with...............: ' . $string . '<br>';
$string2 = preg_replace("/hello/i","goodbye",$string, 1);
print 'Replacing 1 hello........: ' . $string2 . '<br>';
$string2 = str_replace("hello","goodbye",$string, $num);
print 'Replacing all hello(s)..: ' . $string2 . '<br>';
print "The number of replacements is $num";
print "<br>";
?>
<?php include "../include.php"; ?> <!-- hyperlink to see the code -->
</body>
</html>