Related Links : Search Engine Optimization | | Search Engine Marketing | Online Marketing | Freelance Programmer| SEO Thailand | SEO Expert | SEO services | PHP Programmer Thailand | SEO Tutorial | What is SEO |

  Home Our SEO Services SEO Expert Consultant Php Programmer Scripts| Email : sachin {at} jainsachin {dot} com

PHP | Inserts HTML line breaks before all newlines in a string | Manual | Tutorial | Help

SEO Services



Website Programming in PHP / MYSQL



Friends


    Inserts HTML line breaks before all newlines in a string

    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
    


    SEO Tutorial / Articles





    Php / Mysql Tutorial



    Articles



      Portfolio


      SEO by Jainsachin