here what i want to do : i have a string containing HTML tags and i want to cut it using the wordwrap function excluding HTML tags.
I\'m stuck :
publ
If usage of DOM parsing is not the aim and you need only trancate HTML —
take a look at cot_string_truncate function in this Gist. It taken from Cotonti CMF.
It's processed plain text or HTML as well. You can set length and choose how to trancate text — exact characters by limit or by word nearest boundary.
It proper treats HTML entities and serial space characters as one (as it viewed in browser) — so your example should work well:
$test_str = "
Test to be cut
Some text
";
echo cot_string_truncate($test_str, 8);
Result:
Test to