Help me in Optimizng this code

How can I optimize following code.


        <?php
        define('MAGPIE_DIR', 'rss/');
        require_once(MAGPIE_DIR.'rss_fetch.inc');
        $url = "http://feeds.feedburner.com/abc";
        if ( $url ) {
            $rss = fetch_rss( $url );
            $num_items = 20;
            $items = array_slice($rss->items, 0, $num_items);
            $arr = array("?", "abc.com Greetings", "abc Articles - Articles");
            $bw = array("Web", ".htmlhttp://www.abc.com/Web");
            $gms = array("abc.com Games", "htmlhttp://www.abc.com/Games/");
            $musc = array("abc.com Music - RSS Feed", "htmlhttp://www.abc.com/Music");
            $grt = array("http://www.abc.com/Greetings/");
            $grt1 = array("create.php/");
            $rcp = array("http://www.abc.com/Recipes/");
            $rcp1 = array("recipe.php/");

            foreach ($items as $item) {
                $desc = $item['title'];
                $link = $item['link'];

                $desc = str_replace($arr,'', $desc);
                $desc = str_replace($lf,'', $desc);
                $desc = str_replace($bw,'', $desc);
                $desc = str_replace($gms,' Game', $desc);
                $desc = str_replace($musc,'', $desc);

                $link = str_replace($arr,'/', $link);
                $link = str_replace($gms,'html', $link);
                $link = str_replace($musc,'html', $link);
                $link = str_replace($grt,'', $link);
                $link = str_replace($grt1,'http://www.abc.com/Greetings/create.php?', $link);
                $link = str_replace($bw,'.html', $link);
                $link = str_replace($rcp,'', $link);
                $link = str_replace($rcp1,'http://www.abc.com/Recipes/recipe.php?', $link);
                $link = str_replace(".htmlhttp://www.abc.com/Articles",'.html', $link);

                if (preg_match("/\\bLafz\\b/i", "$link.")) { 
                    $link = substr($link, 0, -(strlen("http://www.abc.com/Lafz")));
                    $desc = substr($desc, 0, -(strlen("Lafz")));
                }

                $desc = $desc. "...";
                                    echo '<li><a href="'.$link.'">'. $desc. '</a></li>';
            }
        }
        ?>

See how this goes for you

define('MAGPIE_DIR', 'rss/');
require_once(MAGPIE_DIR . 'rss_fetch.inc');
$url = 'http://feeds.feedburner.com/abc';

if (isset($url)) {
    if (!$rss = fetch_rss($url)) {
        die('An error has occurred while trying to fetch the RSS feed');
    }
    
    $num_items = 20;
    $items = array_slice($rss->items, 0, $num_items);
    
    $replacements = array(
        'arr'  => array('find' => array('?','abc.com Greetings', 'abc Articles - Articles'), 'replace' => array('desc' => '', 'link' => '/')),
        'bw'   => array('find' => array('Web', '.htmlhttp://www.abc.com/Web'), 'replace' => array('desc' => '', 'link' => '.html')),
        'gms'  => array('find' => array('abc.com Games', 'htmlhttp://www.abc.com/Games/'), 'replace' => array('desc' => 'Game', 'link' => 'html')),
        'musc' => array('find' => array('abc.com Music - RSS Feed', 'htmlhttp://www.abc.com/Music'), 'replace' => array('desc' => '', 'link' => 'html')),
        'grt'  => array('find' => 'http://www.abc.com/Greetings/', 'replace' => array('desc' => '', 'link' => '')),
        'grt1' => array('find' => 'create.php/', 'replace' => array('desc' => '', 'link' => 'http://www.abc.com/Greetings/create.php?')),
        'rcp'  => array('find' => 'http://www.abc.com/Recipes/', 'replace' => array('desc' => '', 'link' => '')),
        'rcp1' => array('find' => 'recipe.php/', 'replace' => array('desc' => '', 'link' => 'http://www.abc.com/Recipes/recipe.php?')),
        'artc' => array('find' => '.htmlhttp://www.abc.com/Articles', 'replace' => array('desc' => '', 'link' => '.html'))
    );
    
    foreach($items as $item) {
        $desc = $item['title'];
        $link = $item['link'];
        
        // Description replacements
        foreach(array('arr', 'bw', 'gms', 'musc') as $key) {
            $desc = str_replace($replacements[$key]['find'], $replacements[$key]['replace']['desc'], $desc);
        }
        
        // Link replacements
        foreach(array('arr', 'gms', 'musc', 'grt', 'grt1', 'bw', 'rcp', 'rcp1', 'artc') as $key) {
            $link = str_replace($replacements[$key]['find'], $replacements[$key]['replace']['link'], $link);
        }
        
        if (preg_match("/\\bLafz\\b/i", "$link.")) { 
            $link = substr($link, 0, -(strlen('http://www.abc.com/Lafz')));
            $desc = substr($desc, 0, -(strlen('Lafz')));
        }
        
        $desc = $desc . '...';
        echo '<li><a href="' . $link . '">' . $desc . '</a></li>';
    }
}

Could probably be optimized more and given its 12am here i could be right.

Thanks SGTLegend, I can see the difference in code.