How to use str_replace in php
This article mainly explains "how to use str_replace in php". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn how to use str_replace in php.
1. Concept
The str_replace () function replaces some characters in the string with other characters (case sensitive).
This function is case sensitive. Use the str_ireplace () function to perform a case-insensitive search.
2. Grammar
Str_replace (find,replace,string,count)
3. Parameters
Find 、 replace 、 string 、 count
4. Return value
Returns a string or array with a replacement value.
5. Examples
Create a PHP sample file; then replace multiple strings with the "tr_replace ($vowels,", "Hello World of PHP"); method.
Echo str_replace (array ("m", "I"), array ("n", "z"), "my name is jim!") Echo str_replace (array), "my name is jim!"); $vowels = array ("a", "e", "I", "o", "u", "A", "E", "I", "O", "U"); $onlyconsonants = str_replace ($vowels, "," Hello World of PHP "); echo $onlyconsonants At this point, I believe you have a deeper understanding of "how to use str_replace in php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!