If there is no Chinese in the string, you can use the str_replace() function to replace the string.
Grammar format:
str_replace(find,replace,string,count)
Parameter introduction:
Example:
Change the string "Hello world!" The characters "world" in are replaced with "Shanghai"
echo str_replace("world","Shanghai","Hello world!");
For more related tutorials, please visit php中文网.
The above is the detailed content of What is the string replacement function in php. For more information, please follow other related articles on the PHP Chinese website!