如何使用php解码xml中的html标签

I have tried to decode html tags in xml but the functions of the html tags was not worked. Here is my code:

<?php

$sample = '<p>&nbsp Sample</p>
           <p>Sample 2</p>';

header('Content-type: text/xml');
$output = '<rss version="2.0">';
$output .= '<channel>';
$output = '<description>.utf8_encode(html_entity_decode($sample)).</description>';
echo($output);
$output .= '</channel>';
$output .= '</rss>';
?>

The output was a plain text. The function of <p> tag was not working. and when I remove utf8_encode it error the &nbsp;.

Try this

<?php
$sample = '<p>Sample</p><p>Sample 2</p>';

header('Content-type: text/xml');
$output = '<rss version="2.0">';
$output .= '<channel>';
$output .= '<description>'. strip_tags(utf8_encode(html_entity_decode($sample))).'</description>';
$output .= '</channel>';
$output .= '</rss>';
echo($output);

Result:

<rss version="2.0">
    <channel>
        <description>
            <p>Sample</p>
            <p>Sample 2</p>
        </description>
    </channel>
</rss>

you need to seperate PHP function on string.