Q:

Strip HTML tags from string

I have a website which parses RSS feed from websites and posts them on a page.
The script that runs behind my website, which reads and reformats the RSS feed, is currently stripping all the HTML tags. 
Here's the code; $description = strip_tags($description);

I want to allow tags like <p>, <a> or <br /> but if i do that, for some reason my website becomes a mess. Like the header will have a big space above it.
What would be the solution to that?
=== EDIT === (some more code)
// get all of the sources of news from the database
$get_sources = $db->query("SELECT * FROM ".$prefix."sources ORDER BY last_crawled ASC");
while ($source = $db->fetch_array($get_sources)) {
$feed = new SimplePie($source[url]);

$feed->handle_content_type();  

foreach ($feed->get_items() as $item)  
{  

    $title = $item->get_title();  
    $link = $item->get_link();
    $description = $item->get_content();

    // strip all html
    $description = strip_tags($description);

    // format the data to make sure it's all fine
    $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');

    // create the path, or slug if you will
    $path = post_slug($title);

    $description = html_entity_decode($description, ENT_QUOTES, 'UTF-8');

A:

Before you strip tags, process a string replace to convert the special characters you'd like to keep.
$source = str_replace('<p>', '&lt;p&gt;', $source);
$source = strip_tags($source);

Then use htmlspecialchars_decode(trim($source)) to output to html.
I'm willing to bet that the cause of your page layout going awry is css related. Look through your generated source closely (if possible, with firebug) and make sure that every html element also has a corresponding close tag and that none of your intentional html elements have been changed by your script, though I don't know why they would be.
Try isolating the output of your script to a blank page so that you can get a close look at what's going on. Then once you're sure everything is where is aught to be, if problems persist, try placing the output in different parts of your page. Additionally, make sure you trim your whitespace.
Let us know what you find out.

