0

I've been trying to echo a new line character but it hasn't worked. Each time I loop I would like to add break after each iteration.

foreach($result as $row){

        $node =  '{"author":"' . $row["name"] . '"},';
        echo "\n";

    }

This is what I have but it's still printing all in one line. Any Suggestions?

user4348719
  • 351
  • 1
  • 2
  • 13
  • 1
    look at your HTML source; it's in there alright. Use a combination of - `
    `. with that `\n` and it will show it to you on screen as well. `\n` alone only shows up as a new line if writing to a file.
    – Funk Forty Niner Nov 05 '15 at 19:49
  • 1
    http://stackoverflow.com/questions/4238433/php-how-to-create-a-newline-character – m2j Nov 05 '15 at 19:50
  • 1
    If you want a new line in a browser you have to use a break tag. – Jay Blanchard Nov 05 '15 at 19:51

1 Answers1

2

This will surely work.

foreach($result as $row){
    $node =  '{"author":"' . $row["name"] . '"},';
    echo "<br>";
}
N3R4ZZuRR0
  • 2,400
  • 4
  • 18
  • 32