downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<nl_langinfonumber_format>
Last updated: Thu, 26 Jun 2008

nl2br

(PHP 4, PHP 5)

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

Description

string nl2br ( string $string )

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

Parameters

string

The input string.

Return Values

Returns the altered string.

ChangeLog

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

Examples

Example #1 using nl2br()

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

The above example will output:

foo isn't<br />
 bar



add a noteadd a note User Contributed Notes
Inserts HTML line breaks before all newlines in a string
There are no user contributed notes for this page.




<nl_langinfonumber_format>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs