Php formatting text paragraphs using wordwrap _ PHP Tutorial

Source: Internet
Author: User
Php uses wordwrap to format text paragraphs. Php uses wordwrap to format text paragraphs. This article mainly introduces how php uses wordwrap to format text paragraphs. it involves the use of wordwrap functions, some reference methods for formatting text paragraphs using wordwrap in php

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, see

This example describes how php uses wordwrap to format text paragraphs. 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.

?

1

2

3

4

5

6

7

8

9

10

$ String = "TRADING ON MARGIN POSES ADDITIONAL

RISKS AND IS NOT SUITABLE FOR ALL

INVESTORS.

A COMPLETE LIST OF THE RISKS ASSOCIATED WITH MARGIN TRADING IS

Available 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:

?

1

2

3

4

5

6

TRADING ON MARGIN POSES ADDITIONAL

RISKS AND IS NOT SUITABLE FOR ALL

INVESTORS. A COMPLETE LIST OF

RISKS ASSOCIATED WITH MARGIN TRADING IS

AVAILABLE IN THE MARGIN RISK DISCLOSURE

DOCUMENT.

I hope this article will help you with php programming.

This article describes how to format text paragraphs using wordwrap in php. it involves the use of the wordwrap function and provides some reference...

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.