PHP preg_replace() Function

PHP preg_replace() Function


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

Syntax:

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

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

  • $pattern: This parameter contains the string element which is used to search the content and it can be a string or array of string.