Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix while() and newline (\n), how does it make sense?

Discussion in 'Misc WordPress Requests' started by TheDani, Mar 22, 2018.

  1. TheDani

    Guest

    while() and newline (\n), how does it make sense?, by TheDani

    echo "300-600|Bad Karma
    200
    400|Rose";

    It doesn’t help. I wants to check if the string has a newline. `$activities_label=strstr($activities_label, strpos($activities_label,”PHP_EOL”));
    echo $activities_label;` But doesn’t match. Here is an example:

    $activities_label = get_post_meta(get_the_ID(), "activities_label", true);
    ...
    while($query->have_posts()) :
    ...
    if (false !== strpos($activities_label, '\n') && false !== strpos($activities_label, PHP_EOL)) echo $activities_label;
    endwhile;

    Newbie.

    //view


    Bad Karma
    300-600|Bad Karma
    200
    400|Rose

    Blue Elephant
    300-600|Bad Karma
    200
    400|Rose

    Rose
    300-600|Bad Karma
    200
    400|Rose

    But I wouldn’t have:


    Bad Karma
    300-600|Bad Karma

    Blue Elephant
    200

    Rose
    400|Rose

    while() and newline (\n), how does it make sense?
     
    #1

Share This Page

Monarch Social Sharing Plugin