Forum und email

nl2br

(PHP 4, PHP 5)

nl2br — Inserts HTML line breaks before all newlines in a string

Popis

string nl2br ( string $string )

Returns string with '<br />' inserted before all newlines.

Parametre

string

The input string.

Vrátené hodnoty

Returns the altered string.

ChangeLog

Verzia Popis
4.0.5 nl2br() is now XHTML compliant. All older versions will return string with '<br>' inserted before newlines instead of '<br />'.

Príklady

Example#1 using nl2br()

<?php
echo nl2br("foo isn't\n bar");
?>

Výstup horeuvedeného príkladu bude:

foo isn't<br />
 bar