|
Posted by Kimmo Laine on 02/10/07 13:22
Simon Harris wrote:
> In this case, I want to remove them - I tried your suggestion, but it still
> left & in the string in my test (Using the function below).
>
> function html2txt($document){
> $document = str_replace("<li>"," <li>",$document);
> $search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
> '@<[\\/\\!]*?[^<>]*?>@si', // Strip out HTML tags
> '#&\w+;#iU', // Strip out HTML entities such as
> '@<style[^>]*?>.*?</style>@siU', // Strip style tags
> properly
> '@<![\\s\\S]*?--[ \\t\\n\\r]*>@' // Strip multi-line
> comments including CDATA
> );
> $text = preg_replace($search, '', $document);
> return $text;
> }
>
> Just out of curiosity, how would you decode them? Thinking about it, this
> might actually work better for me.
>
Dude, strip_tags() is your friend. See php.net manual for details.
--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|