Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Php replaces all specified characters

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how Php replaces all the specified characters. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

Php replaces all the specified characters: 1, using the "str_replace (find,replace,string,count)" method; 2, through the "preg_replace ()" method.

This article operating environment: windows7 system, PHP7.1 version, Dell G3 computer.

Common functions are:

Str_replace () and preg_replace ().

The str_replace () function replaces other characters in the string with one string.

Str_replace (find,replace,string,count)

Parameters.

Find is required. Specifies the value to look for.

Replace is required. Specifies the value that replaces the value in find.

String is required. Specifies the string to be searched.

Count is optional. A variable that counts the number of substitutions.

Str_replace ("raykaeso", "leixuesong", "raykaeso love php"); preg_replace (pattern, replacement, subject,limit =-1, $count)

Function: to perform the search and replacement of a regular expression

Pattern is required. The pattern that needs to be searched.

Replacement is required. A string or array used to replace.

Subject is required. A string or array to replace.

The number of limit replacements. -1 is infinite

The number of times count completed the replacement, variable

The above is all the content of the article "how Php replaces all specified characters". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report