user3050628
user3050628

Reputation: 1

Wrong output of heredoc command

Output of the code

echo <<<END
1st line
2nd line
3rd line
END;

Shoud look like that:

1st line
2nd line
3rd line

but it gives me:

1st line 2nd line 3rd line

instead... Any reason for that behavior? Obviously I can use <br /> but heredoc should act differently right?

Upvotes: 0

Views: 29

Answers (1)

user2816674
user2816674

Reputation:

If you look at the page source, it will show you that they are each on a different line but in HTML, that doesn't matter. If you want the output when viewed as HTML to have line breaks, you must use the <br /> tag.

Upvotes: 1

Related Questions