Input text :
Test one two three fourfive
Text is splitted by preg_split
with additional processing and now result array is:
Test one
<span>two</span>
three
<span>four</span>
five
When I echo this array in loop I get this:
Test one two three four five
Four and five should be displayed together, without space.
In HTML source it looks like so:
Test one
<span>two</span>
three
<span>four</span>
five
Extra space is added after four.
When I directly write this in HTML
Test one <span>two</span> three <span>four</span>five
text is echoed correctly. It seems that new line in HTML add extra space. Does someone know what happens here?
A newline is a space. Remove that and your space disappears.