Usage of str_replace () character replacement function in php
| This article describes how to use str_replace () in php and related examples. For more information, see.
Define and use the str_replace function to replace other characters in a string with one character string. The str_replace (find, replace, string, count) parameter description is required. Specifies the value to be searched. Replace is required. Specifies the value to replace the value in find. String is required. Specifies the string to be searched. Count is optional. A variable that counts the number of replicas. Tip and comment: This function is case sensitive. Use str_ireplace () to perform a case-insensitive search. Note: This function is binary secure.
Let's take a look at several examples of str_replace () functions. only by looking at more examples and exercises can we improve the performance.
Example 1:
Output: Hello John!
Example 2:
Output: Array ([0] => blue [1] => pink [2] => green [3] => yellow) Replacements: 1
Example 3:
Output: Array ([0] => B [1] => [2] => !) |