Php uses wordwrap to format text paragraphs

Source: Internet
Author: User
This article mainly introduces how to format text paragraphs using wordwrap in php. it involves the skills of using the wordwrap function and has some reference value, for more information about how to format text paragraphs by using wordwrap in php, see the following example. Share it with you for your reference. The specific analysis is as follows:

The wordwrap () function can format text paragraphs based on the specified fixed line length to make the paragraphs look more neat.

<? Php $ string = "trading on margin poses additionalrisks and is not suitable for all investors. a complete list of the risks associated with margin trading isavailable in the margin risk disclosure document. "; $ string = str_replace (" \ n "," ", $ string); $ string = str_replace (" \ r "," ", $ string ); print (wordwrap ($ string, 40 ). "\ n");?>

The above code returns the following results:

Trading on margin poses additionalrisks and is not suitable for allinvestors. a complete list of therisks associated with margin trading isavailable in the margin risk disclosuredocument.

I hope this article will help you with php programming.

Related Article

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.