Matt Matt - 4 months ago 6
PHP Question

Print newline in PHP in single quotes

I try to use single quotes as much as possible and I've noticed that I can't use \n in single quotes. I know I can just enter a newline literally by pressing return, but that screws up the indentation of my code.

Is there some ASCII character or something that I can type that will produce newline when I'm using single quotes?


No, because single-quotes even inhibit hex code replacement.

echo 'Hello, world!' . "\xA";