str_replace() function is used to replace text in a string. Its first parameter takes the text to find in a given string, in second parameter write text to replace the first parameter text, and the third parameter takes the string in which find and replace operation will be performed.
Syntax-
str_replace(search, replace, subject);
Example-
<?php
$text = "HTML stands for Hypetext Preprocessor.";
$new_string = str_replace("HTML", "PHP", $text);
echo $new_string;
?>
Publish A Comment