Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of the preg_filter () function in PHP

Shulou Source: shulou.com Published: 2022-06-01 02:37:35 09月21日 Update

This article mainly introduces what is the use of the preg_filter() function in PHP, which has certain reference value. Interested friends can refer to it. I hope that after reading this article, you will gain a lot. Let Xiaobian take you to understand it together.

preg_filter() function

The preg_filter function is used to perform a regular expression search and replace. preg_filter() is equivalent to preg_replace(), but it only returns results that match the target.

syntax

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

parameter description

$pattern: The pattern to search for. It can be a string or an array of strings.

$replacement: String or array of strings used for replacement.

$subject: String or array of strings to search and replace.

$limit: Optional, maximum number of substitutions per pattern per subject. The default is-1(infinite).

$count: optional, number of substitutions completed.

Thank you for reading this article carefully, I hope Xiaobian shared "What is the use of the preg_filter() function in PHP" This article is helpful to everyone, and I also hope that everyone will support it a lot, pay attention to the industry information channel, and more relevant knowledge is waiting for you to learn!

Tags: Characters strings functions articles arrays searches patterns times maximum value interest parameters at the same time more friends regularities goals knowledge equivalence results Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei OPPO Reno MariaDB Apple