php - Replace HTML strings with spaces -
this question has reply here:
problem using strip_tags in php [duplicate] 1 reply strip_tags() … replace tags space rather deleting them 8 answersdoes know how can replace html string spaces?
because if have this
<div>word1</div><div>word2</div>
when utilize strip_tags(), result is
word1word2
and need them separated space in order processed way should script.
you can utilize this:
preg_replace('/<[^>]*>/', ' ', $input);
but had best not have stray <
characters in text.
also:
preg_replace('/ {2,}/', ' ', $input);
will collapse multiple spaces single space.
php html replace strip-tags
No comments:
Post a Comment