PHP preg_filter() Function

PHP preg_filter() Function


The preg_filter() function is an inbuilt function in PHP which is used to perform a regular expression search and replace the text.

Syntax:

preg_filter( $pattern, $replacement, $subject, $limit, $count )

Parameters: This function accepts five parameters as mention above and describe below.

  • $pattern: This parameter contains an string element which is search for and it can be a string or array of string.
  • $replacement: It is mandatory parameter which specifies the string or an array with strings to replace.