Home > Article > Backend Development > Divide an article into paragraphs as required. Teach you how to divide an article into paragraphs as required.
$a="This is a short paragraph. Take a look";
$a.="This is another short sentence!";
$a.="The last sentence?";
$a.=" This is the result!";
//Actually, this is a long sentence.
$b=split("[.!?]",$a,4);
//Absolute period,! Numbers, question marks, etc. are segmented according to your own requirements
for($index=0;$index
print "$index.$b[$index]
";
}
//Read the array in the loop.
?>
The above introduces the paragraphing according to requirements and teaches you how to divide an article into paragraphs according to requirements, including the content of paragraphing according to requirements. I hope it will be helpful to friends who are interested in PHP tutorials.