Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

string - 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 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...