nl2br(3) php man page | unix.com

Man Page: nl2br

Operating Environment: php

Section: 3

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
parse_str(3) - php
strip_tags(3) - php
fdf_save_string(3) - php
stristr(3) - php
substr(3) - php
Similar Topics in the Unix Linux Community
greater than less than in case
finding string in very long file without newlines
Increment time
Documenting PHP and HTML and AdminCP Changes
Debian, string in string.