Substr and HTML tags - Problem...

From: Date: Mon, 25 Feb 2002 10:51:55 +0000
Subject: Substr and HTML tags - Problem...
Groups: php.general 
Request: Send a blank email to php-general+get-86064@lists.php.net to get a copy of this message
Hi, I got a small problem: 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 <br> and this tag will be cut by the substr to something like that: <br - it will mess up the webpage... How can I avoid that the html tags are cut by the substr function? Is there a way to make the function know, that it has to leave html tags uncut?? Thanks in advance... Sascha Ragtschaa

« previous php.general (#86064) next »