Jump to content

substr() to ignore tags


conker87

Recommended Posts

I have a little blogging code that shows a little snippit (300 characters) of the blog and then a direct link to it.

 

<php

substr(strip_tags(nl2br($array['content']), "<img><br><br />"), "0", "300");

?>

Is the code I'm using.

 

I'm wondering if I could modify the substr function (thus making my own function) to not count html tags as part of the number of characters shown. I'm sure this can be done, any ideas?

Link to comment
https://forums.phpfreaks.com/topic/100315-substr-to-ignore-tags/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.