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

tellmewhen string php string and character replacement function

Jul 29, 2016 am 08:33 AM

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

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

1

2

<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.

🎜
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

Hot Article

Hot tools Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

6 Extra Skills Every PHP Developer Should Have 6 Extra Skills Every PHP Developer Should Have Feb 28, 2025 am 10:52 AM

6 Extra Skills Every PHP Developer Should Have

Understand Arrays in PHP Understand Arrays in PHP Feb 28, 2025 am 10:53 AM

Understand Arrays in PHP

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

See all articles