Answers for "php change array of strings into paragraphs"

PHP
0

php change array of strings into paragraphs

// array of strings.
$terms = [
'English consumer organisations and lawyers are seeing...',
'',
'Read more at EnglishNews.nl:'
];

// chnage them into paragraphs.
$str = '';
if(!empty($terms)) {
    $str = '<p>' . implode("</p><p>", $terms) . '</p>';
}

print_r($str);
Posted by: Guest on February-08-2021

Code answers related to "php change array of strings into paragraphs"

Browse Popular Code Answers by Language