I originally thought that using double quotes could escape \n or
Perform a newline operation and find
The following code
<?php echo "nocs\n"; echo "you";?>
Online editing The output result of the processor shows
nocs you
The output result of the webpage shows
nocs you
It can be seen that the webpage display does not have a line break effect, it is only displayed as a space
Conclusion:\nLine breaks are only applicable to command line execution
<?php echo "nocs<br>"; echo "you";?>
nocs<br>you
nocs you
You can find that the web page display
achieves the line wrapping effectConclusion
Web page display line breaks can be realized
Found a phenomenon when using double quotes to escape the \n character. The web page display does not realize line wrapping, but when viewing the web page source code, the line wrapping effect is achievedThank you for reading, I hope you will benefit a lot. Recommended tutorial: "When using double quotes to escape
, although the web page displays a line wrapping result, when viewing the web page source code label
is still displayed Come out
This means that the result of viewing the source code of the web page is consistent with the result displayed by compiling PHP from the command line
php tutorial"
The above is the detailed content of 30-day PHP learning record (line break). For more information, please follow other related articles on the PHP Chinese website!