nl2br php

PHP 5, PHP 7). nl2br — Inserts HTML line breaks before all newlines in a string echo nl2br(\"Welcome\\r\\nThis is my HTML document\", false); ?> The above
更多实例 例子 1 通过使用 xhtml 参数,在新行(\\n)之前插入换行符 <?php echo nl2br(\"One line.\\nAnother line.\",false); ?> 以上代码的浏览器输出 One line. Another line.
Example. Insert line breaks where newlines (\\n) occur in the string <?php echo nl2br(\"One line.\\nAnother line.\"); ?> The browser output of the code above will be
Online nl2br() function. Home /; Online PHP functions /; nl2br. string nl2br ( string $str ). Convert endline characters to proper <br/> HTML entities. Result
May 10, 2016 - There is already nl2br() function that replaces inserts tags before new <? php // Won\'t work $desc = \'Line one\\nline two\'; // Should work
Aug 3, 2016 - $message_var_1 = \'test1 \\r\\n test2 \\r\\n test3\';. PHP parses \\r and \\n only within \" , not within \' . So nl2br won\'t apply here. $message_var_1 = \"test1 \\r\\n
Feb 12, 2016 - The nl2br() function is used to insert HTML line breaks (\' \') before all newlines (\\n) in a string.
<?php // nl2br() function nl2br_str ($string) { return str_replace ([\"\\r\\n\", \"\\r\", \"\\n\"], \'<br/>\', $string);} function nl2br_preg_R ($string) { return preg_replace (\'/\\R/u\', \'<br/>\', );} ()