Print newline with single quotes in PHP
P粉436052364
2023-08-23 23:53:11
<p>I tried to use single quotes as much as possible, but I noticed that I can't use n inside single quotes. I know I could enter the newline character directly by pressing enter, but that would break the indentation of my code. </p>
<p>When I use single quotes, is there some ASCII character or something I can type that will produce a newline? </p>
Use the constant PHP_EOL then it is also operating system independent.
No, because single quotes suppress even hex code replacement.