php man page for nl2br

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 string

SYNOPSIS
string nl2br (string $string, [bool $is_xhtml = true])
DESCRIPTION
Returns $string with '<br />' or '<br>' inserted before all newlines ( , , and ).
PARAMETERS
o $string - The input string. o $is_xhtml - Whether to use XHTML compatible line breaks or not.
RETURN VALUES
Returns the altered string.
EXAMPLES
Example #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 ALSO
htmlspecialchars(3), htmlentities(3), wordwrap(3), str_replace(3). PHP Documentation Group NL2BR(3)
Related Man Pages
get_class(3) - php
parse_str(3) - php
nl2br(3) - php
wordwrap(3) - php
fgetss(3) - php
Similar Topics in the Unix Linux Community
greater than less than in case
XHTML Doclet 0.3 (Default branch)
Mandriva: php
convert single line output to multiple line
Increment time