Replacing text with str_replace()
We can replace text in PHP by using a function known as str_replace. We use it by putting in
(“what we want to replace”, “with what we want to replace it with, and the”, $source); that it comes from.
Here are the sources used in this tutorial:
tut006.php
<?php $sent = "The hog went to wash its face. Also, the hog went and rolled around in the mud..."; //echo strlen($sent); /*$sents = explode(".",$sent); $se = implode("!",$sents); echo $se;*/ $sent = str_replace(".","!",$sent); echo $sent; ?>