Table of Contents

Syntax

string nl2br(string $text [, bool $use_xhtml_tags = true])

(PHP 4, PHP 5)

$text The source string to convert.
$use_xhtml_tags Should we use XHTML break tags (<br/>) or normal HTML tags (<br>).
RETURNS The source string with breaks inserted before all newlines.

What it Does

Inserts an XHTML (or HTML) break element before all newlines in the source string.

Example

// insert break elements for each line break in the source
$html = nl2br("One\nTwo\nThree");
echo $html;
 
nl2br.txt · Last modified: 2011/02/16 12:57 by orvado
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki