nl_langinfo
number_format
String Functions
PHP Manual

# 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

### See Also

- htmlspecialchars()
- htmlentities()
- wordwrap()
- str_replace()

nl_langinfo
number_format
String Functions
PHP Manual