Php how to remove line breaks

Source: Internet
Author: User
Php how to remove a carriage return newline character is known to be commonly used in the following methods, but all the line breaks are cleared, each line I want to keep a line break how to deal with it? (That is, to filter multiple linefeeds together)

// 1. use str_replace to replace the line feed.
$ Str = str_replace (array ("/r/n", "/r", "/n"), "", $ str );

// 2. use regular expression replacement
$ Str = preg_replace ('// s */', '', $ str );

// 3. use the variables defined in php (recommended)
$ Str = str_replace (PHP_EOL, '', $ str );


Reply to discussion (solution)

$ Str = preg_replace ("/[\ r \ n] +/", PHP_EOL, $ str );

I have cleared a portion of the text, but the effect is not good. I just hope that this article will remove the carriage return with multiple division in the middle so that there is only one carriage return between each step.

As follows:
First, I would like to send you a picture of my eyebrows that have not been painted, and my eyebrows that have not been modified, so that the whole person may not look very spirited. The short eyebrows are not commensurate with the makeup, it can be seen that eyebrow makeup is really important to the entire makeup.


We will introduce you to the tools that you need to use: a slightly stiff eyebrow pencil, a razor, a split brush, and a flat brush.
Use a eyebrow knife to clear the hairs on both sides of the main line of the eyebrows, so that the main line of the eyebrows is clearer.




Next, use the eyebrow pencil to determine the eyebrow shape, use the eyebrow pencil similar to the hair color, and draft the eyebrow shape.

After the eyebrow is painted, use the eyebrow pencil to fill the box and smear it along the direction of the eyebrows to color the eyebrows.

$ S = <TXT: first, we will send you a picture of the eyebrows that have not been painted, and the eyebrows that have not been modified, which makes the whole person look uninspired. The short eyebrows are not commensurate with eye makeup, it can be seen that eyebrow makeup is really important to the entire makeup. I would like to introduce you to the tools you need to use: a slightly stiff eyebrow pencil, an eyebrow knife, a scatter brush, and a flat brush. I will use a eyebrow knife to clean the hairs on both sides of the main line, make the main line of the eyebrows clearer. Next, use the eyebrow pencil to determine the eyebrow shape, use the eyebrow pencil similar to the hair color, and draft the eyebrow shape. After the eyebrow is painted, use the eyebrow pencil to fill the box and smear it along the direction of the eyebrows to color the eyebrows. TXT; echo preg_replace ("/[\ r \ n] +/", PHP_EOL, $ s );
First, I would like to send you a picture of my eyebrows that have not been painted, and my eyebrows that have not been modified, so that the whole person may not look very spirited. The short eyebrows are not commensurate with the makeup, it can be seen that eyebrow makeup is really important to the entire makeup. I would like to introduce you to the tools you need to use: a slightly stiff eyebrow pencil, an eyebrow knife, a scatter brush, and a flat brush. I will use a eyebrow knife to clean the hairs on both sides of the main line, make the main line of the eyebrows clearer. Next, use the eyebrow pencil to determine the eyebrow shape, use the eyebrow pencil similar to the hair color, and draft the eyebrow shape. After the eyebrow is painted, use the eyebrow pencil to fill the box and smear it along the direction of the eyebrows to color the eyebrows.

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.