PHP How to detect if paragraph contain multiple lines?












0















For example, I have this code:



<p>
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."

</p>


Where the correct would be:



<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


Is it possible to use xpath to do it?
How can I check every p tag, and if the case, format with the correct code?










share|improve this question























  • Are you scraping this from some website you don't control?

    – ryantxr
    Nov 24 '18 at 1:52











  • Yes, I am trying to format some posts I receive from rss feed.

    – Migu3litto
    Nov 24 '18 at 1:55











  • Try explode("n", $input) then format the array elements.

    – ryantxr
    Nov 24 '18 at 1:57











  • @Migu3litto You mention an RSS feed in comments. You think that the related should be added? There could be relevance here and how it's formatted.

    – Funk Forty Niner
    Nov 24 '18 at 3:00
















0















For example, I have this code:



<p>
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."

</p>


Where the correct would be:



<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


Is it possible to use xpath to do it?
How can I check every p tag, and if the case, format with the correct code?










share|improve this question























  • Are you scraping this from some website you don't control?

    – ryantxr
    Nov 24 '18 at 1:52











  • Yes, I am trying to format some posts I receive from rss feed.

    – Migu3litto
    Nov 24 '18 at 1:55











  • Try explode("n", $input) then format the array elements.

    – ryantxr
    Nov 24 '18 at 1:57











  • @Migu3litto You mention an RSS feed in comments. You think that the related should be added? There could be relevance here and how it's formatted.

    – Funk Forty Niner
    Nov 24 '18 at 3:00














0












0








0








For example, I have this code:



<p>
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."

</p>


Where the correct would be:



<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


Is it possible to use xpath to do it?
How can I check every p tag, and if the case, format with the correct code?










share|improve this question














For example, I have this code:



<p>
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."

</p>


Where the correct would be:



<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


Is it possible to use xpath to do it?
How can I check every p tag, and if the case, format with the correct code?







php xpath






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 1:46









Migu3littoMigu3litto

315




315













  • Are you scraping this from some website you don't control?

    – ryantxr
    Nov 24 '18 at 1:52











  • Yes, I am trying to format some posts I receive from rss feed.

    – Migu3litto
    Nov 24 '18 at 1:55











  • Try explode("n", $input) then format the array elements.

    – ryantxr
    Nov 24 '18 at 1:57











  • @Migu3litto You mention an RSS feed in comments. You think that the related should be added? There could be relevance here and how it's formatted.

    – Funk Forty Niner
    Nov 24 '18 at 3:00



















  • Are you scraping this from some website you don't control?

    – ryantxr
    Nov 24 '18 at 1:52











  • Yes, I am trying to format some posts I receive from rss feed.

    – Migu3litto
    Nov 24 '18 at 1:55











  • Try explode("n", $input) then format the array elements.

    – ryantxr
    Nov 24 '18 at 1:57











  • @Migu3litto You mention an RSS feed in comments. You think that the related should be added? There could be relevance here and how it's formatted.

    – Funk Forty Niner
    Nov 24 '18 at 3:00

















Are you scraping this from some website you don't control?

– ryantxr
Nov 24 '18 at 1:52





Are you scraping this from some website you don't control?

– ryantxr
Nov 24 '18 at 1:52













Yes, I am trying to format some posts I receive from rss feed.

– Migu3litto
Nov 24 '18 at 1:55





Yes, I am trying to format some posts I receive from rss feed.

– Migu3litto
Nov 24 '18 at 1:55













Try explode("n", $input) then format the array elements.

– ryantxr
Nov 24 '18 at 1:57





Try explode("n", $input) then format the array elements.

– ryantxr
Nov 24 '18 at 1:57













@Migu3litto You mention an RSS feed in comments. You think that the related should be added? There could be relevance here and how it's formatted.

– Funk Forty Niner
Nov 24 '18 at 3:00





@Migu3litto You mention an RSS feed in comments. You think that the related should be added? There could be relevance here and how it's formatted.

– Funk Forty Niner
Nov 24 '18 at 3:00












3 Answers
3






active

oldest

votes


















1














This code should do what you want. It uses DOMXPath to find all the <p> elements and then splits the content up into separate lines using preg_split, replacing the content of the original <p> element with the first line and then adding new <p> elements as required for each of the subsequent lines.



$doc = new DOMDocument();
$doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$paras = $xpath->query('//p');
foreach ($paras as $p) {
$lines = preg_split('/(s*[rn]s*)+/', $p->textContent, -1, PREG_SPLIT_NO_EMPTY);
$p->textContent = array_shift($lines);
foreach ($lines as $line) {
// create a new <p> element
$new = $doc->createElement('p');
$new->textContent = $line;
$p->parentNode->insertBefore($new, $p->nextSibling);
}
}
echo $doc->saveHTML();


Output for your sample data:



<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


Note that this code will only work when the <p> element does not contain any child HTML elements (e.g. <a> etc.). If that is the case the problem becomes a lot more complex...



Demo on 3v4l.org






share|improve this answer

































    1














    I don't think you can do it with Xpath but here php example



    <?php
    $paragraph = <<<EOF
    <p>
    "Lorem Ipsum is simply dummy text.

    Letraset sheets containing ."

    </p>
    EOF;

    foreach(explode("n", $paragraph) as $line)
    {
    if(!empty($line) && strrpos($line, 'p>') === false)
    echo "<p>" . trim($line, '"') . "</p>n";
    }





    share|improve this answer































      0














      A simple method is to use preg_split() . After that echo them out wrapped in <p> tag



      Here are the example



      PHP



      <?php
      // example code

      $status = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.

      Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


      It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

      Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";


      $tagsp = preg_split('/n+/', $status);

      foreach($tagsp as $p)
      {
      if(strlen($p) > 0)
      {
      echo "<p>$p</p>";
      }
      }


      DEMO






      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454505%2fphp-how-to-detect-if-paragraph-contain-multiple-lines%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        This code should do what you want. It uses DOMXPath to find all the <p> elements and then splits the content up into separate lines using preg_split, replacing the content of the original <p> element with the first line and then adding new <p> elements as required for each of the subsequent lines.



        $doc = new DOMDocument();
        $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
        $xpath = new DOMXpath($doc);
        $paras = $xpath->query('//p');
        foreach ($paras as $p) {
        $lines = preg_split('/(s*[rn]s*)+/', $p->textContent, -1, PREG_SPLIT_NO_EMPTY);
        $p->textContent = array_shift($lines);
        foreach ($lines as $line) {
        // create a new <p> element
        $new = $doc->createElement('p');
        $new->textContent = $line;
        $p->parentNode->insertBefore($new, $p->nextSibling);
        }
        }
        echo $doc->saveHTML();


        Output for your sample data:



        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
        <p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
        <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


        Note that this code will only work when the <p> element does not contain any child HTML elements (e.g. <a> etc.). If that is the case the problem becomes a lot more complex...



        Demo on 3v4l.org






        share|improve this answer






























          1














          This code should do what you want. It uses DOMXPath to find all the <p> elements and then splits the content up into separate lines using preg_split, replacing the content of the original <p> element with the first line and then adding new <p> elements as required for each of the subsequent lines.



          $doc = new DOMDocument();
          $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
          $xpath = new DOMXpath($doc);
          $paras = $xpath->query('//p');
          foreach ($paras as $p) {
          $lines = preg_split('/(s*[rn]s*)+/', $p->textContent, -1, PREG_SPLIT_NO_EMPTY);
          $p->textContent = array_shift($lines);
          foreach ($lines as $line) {
          // create a new <p> element
          $new = $doc->createElement('p');
          $new->textContent = $line;
          $p->parentNode->insertBefore($new, $p->nextSibling);
          }
          }
          echo $doc->saveHTML();


          Output for your sample data:



          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
          <p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
          <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
          <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


          Note that this code will only work when the <p> element does not contain any child HTML elements (e.g. <a> etc.). If that is the case the problem becomes a lot more complex...



          Demo on 3v4l.org






          share|improve this answer




























            1












            1








            1







            This code should do what you want. It uses DOMXPath to find all the <p> elements and then splits the content up into separate lines using preg_split, replacing the content of the original <p> element with the first line and then adding new <p> elements as required for each of the subsequent lines.



            $doc = new DOMDocument();
            $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
            $xpath = new DOMXpath($doc);
            $paras = $xpath->query('//p');
            foreach ($paras as $p) {
            $lines = preg_split('/(s*[rn]s*)+/', $p->textContent, -1, PREG_SPLIT_NO_EMPTY);
            $p->textContent = array_shift($lines);
            foreach ($lines as $line) {
            // create a new <p> element
            $new = $doc->createElement('p');
            $new->textContent = $line;
            $p->parentNode->insertBefore($new, $p->nextSibling);
            }
            }
            echo $doc->saveHTML();


            Output for your sample data:



            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
            <p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
            <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
            <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


            Note that this code will only work when the <p> element does not contain any child HTML elements (e.g. <a> etc.). If that is the case the problem becomes a lot more complex...



            Demo on 3v4l.org






            share|improve this answer















            This code should do what you want. It uses DOMXPath to find all the <p> elements and then splits the content up into separate lines using preg_split, replacing the content of the original <p> element with the first line and then adding new <p> elements as required for each of the subsequent lines.



            $doc = new DOMDocument();
            $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
            $xpath = new DOMXpath($doc);
            $paras = $xpath->query('//p');
            foreach ($paras as $p) {
            $lines = preg_split('/(s*[rn]s*)+/', $p->textContent, -1, PREG_SPLIT_NO_EMPTY);
            $p->textContent = array_shift($lines);
            foreach ($lines as $line) {
            // create a new <p> element
            $new = $doc->createElement('p');
            $new->textContent = $line;
            $p->parentNode->insertBefore($new, $p->nextSibling);
            }
            }
            echo $doc->saveHTML();


            Output for your sample data:



            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
            <p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
            <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
            <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>


            Note that this code will only work when the <p> element does not contain any child HTML elements (e.g. <a> etc.). If that is the case the problem becomes a lot more complex...



            Demo on 3v4l.org







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 24 '18 at 3:11

























            answered Nov 24 '18 at 2:46









            NickNick

            31.9k121942




            31.9k121942

























                1














                I don't think you can do it with Xpath but here php example



                <?php
                $paragraph = <<<EOF
                <p>
                "Lorem Ipsum is simply dummy text.

                Letraset sheets containing ."

                </p>
                EOF;

                foreach(explode("n", $paragraph) as $line)
                {
                if(!empty($line) && strrpos($line, 'p>') === false)
                echo "<p>" . trim($line, '"') . "</p>n";
                }





                share|improve this answer




























                  1














                  I don't think you can do it with Xpath but here php example



                  <?php
                  $paragraph = <<<EOF
                  <p>
                  "Lorem Ipsum is simply dummy text.

                  Letraset sheets containing ."

                  </p>
                  EOF;

                  foreach(explode("n", $paragraph) as $line)
                  {
                  if(!empty($line) && strrpos($line, 'p>') === false)
                  echo "<p>" . trim($line, '"') . "</p>n";
                  }





                  share|improve this answer


























                    1












                    1








                    1







                    I don't think you can do it with Xpath but here php example



                    <?php
                    $paragraph = <<<EOF
                    <p>
                    "Lorem Ipsum is simply dummy text.

                    Letraset sheets containing ."

                    </p>
                    EOF;

                    foreach(explode("n", $paragraph) as $line)
                    {
                    if(!empty($line) && strrpos($line, 'p>') === false)
                    echo "<p>" . trim($line, '"') . "</p>n";
                    }





                    share|improve this answer













                    I don't think you can do it with Xpath but here php example



                    <?php
                    $paragraph = <<<EOF
                    <p>
                    "Lorem Ipsum is simply dummy text.

                    Letraset sheets containing ."

                    </p>
                    EOF;

                    foreach(explode("n", $paragraph) as $line)
                    {
                    if(!empty($line) && strrpos($line, 'p>') === false)
                    echo "<p>" . trim($line, '"') . "</p>n";
                    }






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 24 '18 at 2:54









                    ewwinkewwink

                    11.9k22239




                    11.9k22239























                        0














                        A simple method is to use preg_split() . After that echo them out wrapped in <p> tag



                        Here are the example



                        PHP



                        <?php
                        // example code

                        $status = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.

                        Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


                        It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

                        Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";


                        $tagsp = preg_split('/n+/', $status);

                        foreach($tagsp as $p)
                        {
                        if(strlen($p) > 0)
                        {
                        echo "<p>$p</p>";
                        }
                        }


                        DEMO






                        share|improve this answer




























                          0














                          A simple method is to use preg_split() . After that echo them out wrapped in <p> tag



                          Here are the example



                          PHP



                          <?php
                          // example code

                          $status = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.

                          Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


                          It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

                          Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";


                          $tagsp = preg_split('/n+/', $status);

                          foreach($tagsp as $p)
                          {
                          if(strlen($p) > 0)
                          {
                          echo "<p>$p</p>";
                          }
                          }


                          DEMO






                          share|improve this answer


























                            0












                            0








                            0







                            A simple method is to use preg_split() . After that echo them out wrapped in <p> tag



                            Here are the example



                            PHP



                            <?php
                            // example code

                            $status = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.

                            Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


                            It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

                            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";


                            $tagsp = preg_split('/n+/', $status);

                            foreach($tagsp as $p)
                            {
                            if(strlen($p) > 0)
                            {
                            echo "<p>$p</p>";
                            }
                            }


                            DEMO






                            share|improve this answer













                            A simple method is to use preg_split() . After that echo them out wrapped in <p> tag



                            Here are the example



                            PHP



                            <?php
                            // example code

                            $status = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.

                            Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


                            It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of

                            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";


                            $tagsp = preg_split('/n+/', $status);

                            foreach($tagsp as $p)
                            {
                            if(strlen($p) > 0)
                            {
                            echo "<p>$p</p>";
                            }
                            }


                            DEMO







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 24 '18 at 2:57









                            Fiido93Fiido93

                            1,4851918




                            1,4851918






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454505%2fphp-how-to-detect-if-paragraph-contain-multiple-lines%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Create new schema in PostgreSQL using DBeaver

                                Deepest pit of an array with Javascript: test on Codility

                                Costa Masnaga