I have a data in mysql table:
<p>aaaa</p>
<p> </p>
<p>asd</p>
and I need to display it like this:
aaaa asd
But I can't seem to get it right.
First I'm using this code:
$string = htmlspecialchars_decode(stripslashes($string)); // $string contains data from the table
and I tried this: (from here)
$string = trim(preg_replace('/\s+/', ' ', $string));
and also this: (from here)
$string = str_replace(array("\n", "\r"), '', $string);
but nothing works!
when I use echo $string; it still shows an empty line. can anyone give a solution?
` tags? Those are causing the line breaks.
– simon Nov 30 '16 at 08:26
Tags in your "string" and then maybe wrap the whole lot up in paragraph tags once that is done... – TimBrownlaw Nov 30 '16 at 08:31