Home >Backend Development >PHP Problem >What is the string replacement function in php

What is the string replacement function in php

王林
王林Original
2020-04-25 16:00:493168browse

What is the string replacement function in php

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:

What is the string replacement function in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does => in php mean?Next article:What does => in php mean?