Syntax:str_replace(find,replace,string,count)
find: Specifies the value to be found.
replace: Specifies the value to be replaced. This value is also used to replace the value in find.
string: Specifies the string to be searched.
count: Count the number of substitutions.
Let’s list a few examples of combining functions
1. Change the color of the found value
$str = "hello, world!";
$find = 'hello';
echo (str_replace($find, "".$find."", $str));
2. Change the size of the found value
$str = "hello, world!";
$find = 'hello';
echo (str_replace($find, "".$find."", $str));
It is worth mentioning that the use of str_replace is very simple, but in It is very useful when doing projects. In fact, it can also play a role in many places. As long as you observe carefully, you will definitely find a lot of fun. In addition, str_replace is case-sensitive. We should replace it with str_ireplace when we are doing projects. Remember, remember.
The above has introduced the str_replace function in PHP, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.