\n or \n in php echo not print

php, string

Solution

PHP only interprets escaped characters (with the exception of the escaped backslash `\\` and the escaped single quote `\'`) when in double quotes (`"`)

This works (results in a newline):

"\n"

This does not result in a newline:

'\n'

Problem

Possible Duplicate: Print newline in PHP in single quotes Difference between single quote and double quote string in php ``` $unit1 = 'paragrahp1'; $unit2 = 'paragrahp2'; echo '<p>' . $unit1 . '</p>\n'; echo '<p>' . $unit2 . '</p>'; ``` This is displaying (on view source): ``` <p>paragraph1</p>\n<p>paragraph2</p> ``` but isnt what I’m expecting, not printing the new line, what can be?

Original source

Related problems