How to segment an article as required _ PHP Tutorial

Source: Internet
Author: User
Teach you how to segment an article as required .? Php $ a: This is a small paragraph. see it; $ a. This is a small sentence !; $ A. Last sentence ?; $ A. This is the result !; In fact, this is a long sentence. $ Bsplit ([.!?], $ A, 4); end ,! No. $ A = "this is a small paragraph. See It ";
$ A. = "this is another sentence! ";
$ A. = "Last sentence? ";
$ A. = "this is the result! ";
// In fact, this is a long sentence.

$ B = split ("[\.\! \?] ", $ A, 4 );
// Full stop ,! Number and question mark are segmented according to your own requirements

For ($ index = 0; $ index {
Print "$ index. $ B [$ index]
";
}
// Read the array in a loop.

?>

Http://www.bkjia.com/PHPjc/315902.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/315902.htmlTechArticle? Php $ a = This is a small paragraph. see it; $ a. = This is a small sentence !; $ A. = last sentence ?; $ A. = This is the result !; // In fact, this is a long sentence. $ B = split ([\.\! \?], $ A, 4); // end ,! ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.