How to use wordwrap to format text paragraphs in php, _PHP tutorial

WBOY
Release: 2016-07-13 10:02:46
Original
985 people have browsed it

How PHP uses wordwrap to format text paragraphs,

The example in this article describes how PHP uses wordwrap to format text paragraphs. Share it with everyone for your reference. The specific analysis is as follows:

The wordwrap() function can format text paragraphs according to the specified fixed line length, making the paragraphs look neater

<&#63;php
$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");
&#63;>
Copy after login

The above code returns the following results

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.
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969504.htmlTechArticleHow PHP uses wordwrap to format text paragraphs. This article illustrates how PHP uses wordwrap to format text paragraphs. Share it with everyone for your reference. The specific analysis is as follows: wor...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template