Home > Backend Development > PHP Tutorial > tellmewhen string php string and character replacement function

tellmewhen string php string and character replacement function

WBOY
Release: 2016-07-29 08:33:16
Original
2183 people have browsed it

The most efficient and simplest character replacement function in the php tutorial

str_replace($arr1,$arr2,$str)Example 1:str_replace($arr1,$arr2,$str)实例一:

<code><span>str_replace(<span>"iwind"</span>, <span>"kiki"</span>, <span>"i love iwind, iwind said"</span>)</span>;
</code>
Copy after login

将输出 “i love kiki, kiki saidrrreee

will output "i love kiki, kiki said"

The result

is to replace all "iwind" in the original string with "kiki". str_replace is case-sensitive, so you cannot imagine using str_replace("iwind", " kiki",...) replaces "iwind" in the original string. str_replace can also implement many-to-one

Definition and usage

str_replace() function uses a string to replace other characters in the string.

Syntax


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.

The article is edited and organized by the information network http://www.ziliao999.com').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the tellmewhen string PHP string and character replacement functions, including the tellmewhen string content. I hope it will be helpful to friends who are interested in PHP tutorials.

🎜
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template