Home > PHP > Function > PCRE > preg_filter()

preg_filter()

preg_filter - Perform a regular expression search and replace

Syntax

mixed preg_filter (mixed $pattern, mixed $replacement, mixed $subject, int $limit, int &$count)

Arguments

  • pattern - The exponent
  • replacement - The exponent
  • subject - The exponent
  • limit - The exponent
  • count - The exponent

Description

preg_filter() is identical to preg_replace() except it only returns the matches. For details about how this function works, read the preg_replace() documentation.

Version

PHP 5.3.0

Return value

Returns an array if the subject parameter is an array, or a string otherwise.