<description><img src='http://example.com/Pic_018_70x70.gif'></img><br />This is the content of the description.</description>
Если у меня есть изображения, поступающие в поле описания канала, как я могу разделить изображение на переменную, удалить шум и оставить описание тоже?
Вы также можете использовать simplexml
$xml = simplexml_load_string($string); $description = $xml->description;
Это даст вам значение атрибута img src из строки вашего вопроса и даст вам текст:
$sxml = new SimpleXMLElement(html_entity_decode($str)); $images = $sxml->xpath('//@src'); $text = $sxml->xpath('//description'); echo $images[0]; // http://example.com/Pic_018_70x70.gif echo $text[0]; // This is the content of the description.