Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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]);
Source by www.daniweb.com #
 
PREVIOUS NEXT
Tagged: #php #paragraphs
ADD COMMENT
Topic
Name
1+5 =