RE: [PHP] Substr and HTML tags - Problem...

2002-02-25 Thread Jon Haworth
> Personally when I'm doing teasers I strip all HTML from the content > before using substr: > > $teaser = strip_tags($content); > $teaser = substr($teaser, 0, 100); > $teaser .= '...'; // Nice touch to have a '...' on the end :) > You don't have a handy way to check that your substr() doe

Re: [PHP] Substr and HTML tags - Problem...

2002-02-25 Thread Simon Willison
Sascha Ragtschaa wrote >I need to limit a teaser-text via substr($teaser,0,100). The Problem I now >have is, if the last 4 string chars are a html tag like and this tag >will be cut by the substr to something like that: webpage... > >How can I avoid that the html tags are cut by the substr funct