php method to replace symbols: first create a PHP sample file; then replace the # symbol with the ¥ symbol through the "str_replace("#", "¥", $str); method; finally output the replacement result That’s it.
The operating environment of this tutorial: Windows 7 system, PHP version 7.1. This method is suitable for all brands of computers.
Recommended: "PHP Video Tutorial"
php replacement symbol will replace # with ¥
$str = str_replace("#", "¥", $str);
str_replace() function Use a string to replace other characters in a string.
str_replace(find,replace,string,count)
Parameter description
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. A variable counting the number of substitutions.
This function is case sensitive. Please use str_ireplace() to perform a case-insensitive search.
Note: This function is binary safe.
The above is the detailed content of How to replace symbols in php. For more information, please follow other related articles on the PHP Chinese website!