php uses regular expressions to remove the p tag: [preg_replace("/
|<\/p>/is","", $str)]. The preg_replace() function is used to perform a regular expression search and replacement. *?>
The preg_replace() function is used to perform a regular expression search and replacement.
Recommended: "php Video Tutorial"
The code example is as follows:
$new = preg_replace("/<p.*?>|<\/p>/is","", $str); var_dump($new);
The above is the detailed content of How to use regular expression to remove p tag in php. For more information, please follow other related articles on the PHP Chinese website!