method text2html documentation in bbn\Str

Converts text to HTML replacing new lines with brs.

Example

var_dump(\bbn\Str::text2html("foo\n bar")); // (string) '

foo
bar

' var_dump(\bbn\Str::text2html("foo\n bar", false)); // (string) 'foo
bar'
function(string $st, bool $paragraph = true) { if ($paragraph) { $bits = X::split($st, PHP_EOL.PHP_EOL); $st = '

'.X::join($bits, '

').'

'; } return str_replace(PHP_EOL, '
', $st); }

Converts text to HTML replacing new lines with brs. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.