PHP  
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: Mon, 16 Jul 2012

nl2br

(PHP 3, 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.

注: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions before 4.0.5 will return string with '<br>' inserted before newlines instead of '<br />'.

例子 1. using nl2br()

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

this will output :

foo isn't<br />
 bar

See also htmlspecialchars(), htmlentities(), wordwrap(), and str_replace().




<nl_langinfonumber_format>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST