' in php-PHP Tutorial-php.cn" in php is: "\n" causes the source code to wrap, but the content displayed by the browser does not; "
" causes the browser to display the content Line breaks, while the source code does not."/>
" in php is: "\n" causes the source code to wrap, but the content displayed by the browser does not; "
" causes the browser to display the content Line breaks, while the source code does not.">
Home >Backend Development >PHP Tutorial >The difference between the characters '\n' and '
' in php
When writing PHP script code, we often see the two characters \n and
. They both have the function of breaking lines, so what exactly do they mean? What's the difference?
1.\n is to make the source code wrap, but the content displayed by the browser is not;
2.
is to make The content displayed by the browser wraps, but the source code does not.
Example:
PHP code 1:
<?php echo 0; echo "\n"; echo 1; ?>
Browser display:
##No newlineView source code: With line breaks<?php echo 0; echo "<br />"; echo 1; ?>Browser display:
The above is the detailed content of The difference between the characters '\n' and '
' in php. For more information, please follow other related articles on the PHP Chinese website!