English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
nl2The br() function is used to insert an HTML newline tag before all new lines in the string.
string nl2br ( string $string [, bool $is_xhtml = true ] )
Insert '<br />' or '<br>' and return.
It returns the modified string.
Serial number | Parameters and descriptions |
---|---|
1 | string Input string. |
2 | is_xhtml Whether to use XHTML compatible newline characters. |
Try the following example, insert a newline character (<br /):
<?php echo nl2br("oldtoolbag.com.\nAnother line."); ?>Test to see‹/›
Output result
oldtoolbag.com Another line.
View the source code, the result is as follows:
oldtoolbag.com<br /> Another line.