<html>
<body>
<p>Search the string "Hello World!", find the value "world" and replace it with "Peter":</p>
echo str_replace("world","Peter","Hello world!");
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_func_string_str_replace by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:22:59 GMT -->
</html>
Search the string "Hello World!", find the value "world" and replace it with "Peter":
Hello Peter!