header

Remove HTML formatting

I was looking for functionality to remove the html tags from text (i.e. anything of this format <*>). I’m sure there’s a built-in PHP function to do this, but I couldn’t find one, so I made a function:

function get_plaintext($in){
//goes from < to the next > and removes it.
return stripslashes(preg_replace(’/\< [^>]+\>/’,”,$in));
}

2 Comments »

  1. gravatar

    Paolo Said,

    September 12, 2005 @ 10:43 am

    http://php.net/striptags

  2. gravatar

    Raybdbomb Said,

    September 12, 2005 @ 11:07 am

    You mean

    http://php.net/strip_tags

    good call

RSS feed for comments on this post · TrackBack URI

Leave a Comment

blogtimes