View Full Version : Forcing wordwrap() to ignore HTML tags

10-11-2009, 05:02 PM

Yesterday I received help regarding the functino wordwrap(). It's good but after a bit I noticed it wraps HTML tags too.

Like, I have a long sentence which includes <b></b>, some font color styling etc. and it gets messed up when it adds in a space between. (I.e. </f ont>, < /b> etc.)

Then I researched it a bit and found some people posting their custom wordwrap function which ignores HTML tags, but apparently some letters are missing, when I output my string.

Does anyone have an idea of how I could do this?

EDIT: I just found this: http://php.net/manual/en/function.wordwrap.php#89782
Apparently it works fine for me at this point, although there's a notice about an issue in the script.

Considering everything works as it should right now, my issue is resolved. But if anyone knows anything about it, please tell me.