- You can pass multiple values in array as parameters to the str_replace function.
// Result: I love to develop static websites using HTML and CSS
$string = "I love to develop dynamic websites using PHP and Mysql";
$string_words = array("dynamic", "PHP", "Mysql");
$new_string_words = array("static", "HTML", "CSS");
echo $new_string = str_replace($string_words, $new_string_words, $string);
No comments:
Post a Comment