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

What are the regular substitution functions of php

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian for you to introduce in detail "what are the regular replacement functions of php", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what are the regular replacement functions of php" can help you solve your doubts? let's follow the editor's way of thinking to learn new knowledge.

The preg_filter function is used to perform a regular expression search and replacement.

Preg_filter () is equivalent to preg_replace (), but it only returns results that match the target.

Grammar

Mixed preg_filter (mixed $pattern, mixed $replacement, mixed $subject [, int $limit =-1 [, int & $count]])

Parameter description

Pattern: the pattern to search for. Can be a string or an array of strings.

Replacement: the string or array of strings used for replacement.

Subject: the string or array of strings to search for and replace.

$limit: optionally, the number of times each mode is replaced on each subject. The default is-1 ().

$count: optional, number of replacements completed.

2. The preg_replace_callback function performs a regular expression search and replaces it with a callback.

Except that you can specify a callback instead of replacement to evaluate the replacement string, other aspects are equivalent to preg_replace ().

Grammar

Mixed preg_replace_callback (mixed $pattern, callable $callback, mixed $subject [, int $limit =-1 [, int & $count]])

Parameter description

$pattern: the pattern to search for, you can make a string or an array of strings.

Callback: a callback function that is called every time a replacement is needed, and the parameters obtained by the function are matched from the subject.

Subject: the target string or array of strings to search for replacement.

$limit: optional, the number of replaceable times that each pattern is used for each subject string. Default is-1 (system).

$count: optional, the number of times the replacement is executed.

After reading this, the article "what are the regular replacement functions of php" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, please 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

Internet Technology

Wechat

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

12
Report