Add new line with char13 in php

In PHP, you can add a new line with the character code 13 (which is the ASCII code for a carriage return) using the following methods:

  1. Using the \r escape sequence:
    echo "Hello\rWorld!";

    This will output:

    Hello
    World!
  2. Using the chr() function:
    echo chr(13). "Hello World!";

    This will also output:

    Hello
    World!
  3. Using the PHP_EOL constant (available in PHP 5.1 and later):
    echo "Hello". PHP_EOL. "World!";

    This will output:

    Hello
    World!

    Note that PHP_EOL is a constant that represents the end-of-line character for the current platform (e.g. \n on Unix, \r\n on Windows, etc.).

You can also use the nl2br() function to add new lines to a string:

$string = "Hello World!";
echo nl2br($string);

This will output:

Hello World!

The nl2br() function converts all occurrences of \n (or \r\n on Windows) to <br /> tags, which can be useful for formatting text for display in a web page.