0

Difference between \n and <br> in php?

My first hello to the community :) I'm not quite sure when to use \n or <br> for an new line. I first tried to use \n instead of <br> in line 20. It does not work. So, maybe \n is used when assigning a value to a variable and <br> is used for output? Am I right? My code is here: https://code.sololearn.com/w2SCHeG8DYa5/#php Thanks for any explanation.

1st Nov 2018, 9:18 PM
Dave
Dave - avatar
2 Antworten
+ 7
New lines in html source file have no effect on the output so echoing them to the output with PHP also has no effect. You must use html tags (such as <br>) to modify the default browser processing.
1st Nov 2018, 10:33 PM
John Wells
John Wells - avatar
+ 1
Thank you
2nd Nov 2018, 7:23 PM
Dave
Dave - avatar