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?
Single or double quotes in PHP programming are used to define a string. But, there are lots of differences between these two. Single-quoted Strings: It is the easiest way to define a string. You can use it when you want the string to be exactly as it is written.
The nl2br() function inserts HTML line breaks (<br> or <br />) in front of each newline (\n) in a string.
?> Using new line tags: Newline characters \n or \r\n can be used to create a new line inside the source code.
No, because single-quotes even inhibit hex code replacement.
echo 'Hello, world!' . "\xA";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With