PHP - nl2br
Trieda
Metóda - nl2br
(PHP 4, PHP 5, PHP 7)
The nl2br() function replaces end of lines (\n)
with the <br /> tag. This can be useful for printing
texts that may be provided by users within textarea.
Procedurálne
- function nl2br (string $string, bool $is_xhtml = true) : string
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $string | string | The string to replace. | |
| $is_xhtml | bool | true | Whether to insert XHTML symbols. The default value is TRUE.
Which means that the |
Mávratovej hodnoty
Vracia: string
A string with HTML tags as a line break.
Príklady
<?php
$s = "Hello there,\nwelcome here!";
echo nl2br($s);
Súvisiace manuály
- function htmlspecialchars (string $string, int $flags = ENT_COMPAT | ENT_HTML401, string $encoding = ini_get("default_charset"), bool $double_encode = true) : string
- function str_replace (mixed $search, mixed $replace, mixed $subject, int &$count) : mixed
