Answers for "php get first two paragraphs"

PHP
0

php get first two paragraphs

$str = "<p>This is one</p><p>This is two</p><p>This is three</p>";
$pattern="/(<p[^>]*>(.*)<\/p>){2}/isU";
preg_match($pattern,$str,$matches);
echo htmlentities($matches[0]);
Posted by: Guest on August-13-2021

Code answers related to "php get first two paragraphs"

Browse Popular Code Answers by Language