Showing posts with label Why doesn’t the following code print the newline properly? lt;?php $str = ‘Hello. Show all posts
Showing posts with label Why doesn’t the following code print the newline properly? lt;?php $str = ‘Hello. Show all posts

Saturday, May 16, 2009

Why doesn’t the following code print the newline properly?

Because inside the single quotes the \n character is not interpreted as newline, just as a sequence of two characters - \ and n.