
Truncates Sentences
August 26, 2007This code truncates a paragraph to specified sentences:
$entry = "This is the first sentence. And the second sentence. The third sentence. And the fourth.";
$sentence = preg_split("/[\.\!\?]/", $entry);
for($i=0; $i<count($sentence);>
echo("$sentence[$i]<br />\n");
}</count($sentence);>
–
From my codix.