Query: nl2br
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
NL2BR(3) 1 NL2BR(3) nl2br - Inserts HTML line breaks before all newlines in a stringSYNOPSISstring nl2br (string $string, [bool $is_xhtml = true])DESCRIPTIONReturns $string with '<br />' or '<br>' inserted before all newlines ( , , and ).PARAMETERSo $string - The input string. o $is_xhtml - Whether to use XHTML compatible line breaks or not.RETURN VALUESReturns the altered string.EXAMPLESExample #1 Using nl2br(3) <?php echo nl2br("foo isn't bar"); ?> The above example will output: foo isn't<br /> bar Example #2 Generating valid HTML markup using the $is_xhtml parameter <?php echo nl2br("Welcome This is my HTML document", false); ?> The above example will output: Welcome<br> This is my HTML document Example #3 Various newline separators <?php $string = "This is a string "; echo nl2br($string); ?> The above example will output: This<br /> is<br /> a<br /> string<br />CHANGELOG+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Added the optional $is_xhtml parameter. Before | | | this version '<br />' was always inserted. | | | | +--------+---------------------------------------------------+SEE ALSOhtmlspecialchars(3), htmlentities(3), wordwrap(3), str_replace(3). PHP Documentation Group NL2BR(3)
Related Man Pages |
---|
get_class(3) - php |
nl2br(3) - php |
strip_tags(3) - php |
stristr(3) - php |
substr(3) - php |
Similar Topics in the Unix Linux Community |
---|
greater than less than in case |
XHTML Doclet 0.4 (Default branch) |
Awk - Handling different types of newlines |
convert single line output to multiple line |
Loop overwrite first input |