PHP Replacing Substrings Using Str_Replace() – String Function

 
str_replace() replaces all instances of a string within another string. <?php
    $string = "Site contents copyright 2003.";
    $string .= "The 2003 Guide";
    print str_replace("2003","2004",$string);
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.