Home > Article > Backend Development > How to remove characters in php
How to remove characters in php?
If you don’t have Chinese, you can use str_replace
str_replace(find,replace,string,count)
str_replace()
The function replaces some characters in the string with other characters ( Case sensitive)
Parameters
find Required. Specifies the value to look for.
replace Required. Specifies the value to replace the value in find.
string Required. Specifies the string to be searched for.
count Optional. Variable counting the number of substitutions.
Example: Replace the character "world" in the string "Hello world!" with "Shanghai"
echo str_replace("world","Shanghai","Hello world!");
Output result:
Hello Shanghai!
Recommendation: " PHP tutorial》
The above is the detailed content of How to remove characters in php. For more information, please follow other related articles on the PHP Chinese website!