Jump to content

[SOLVED] Remove tags


Eljay

Recommended Posts

I would like to remove the tags (</i>&) from a xml feed. I have tried the following code below..must be a simpler way to do this. I just want to clean it up. Any help would be appreciated.

$rc4clean = str_replace(
array('<', '>', '<li>'),
array('', '', ''),
$rc4);

&lt;/i&gt;&lt;/B&gt;&lt;/font&gt;&lt;/center&gt;</ProductDescription><Availability>Usually Ships in 24 Hours</Availability><Price>8.7500</DiscountedPrice><ProductManufacturer>ABC</ProductManufacturer><ProductPrice>18</ProductPrice><Ships>N</Ships><ProductFeatures>&lt;ul&gt;&lt;li&gt;Ni-Cd Battery

Link to comment
https://forums.phpfreaks.com/topic/154287-solved-remove-tags/
Share on other sites

It might be easier if you use html_entity_decode on the string then do a replace of the actual tags instead of having to use the entity version.

 

Since you have many tags that you do not want filtered out, strip_tags probably would not work for you. Anyhow, hope that helps you get it sorted easier/better.

 

As far as a simpler way, I do not think there is, but that might make it cleaner since it will be <b> instead of & ...etc

Link to comment
https://forums.phpfreaks.com/topic/154287-solved-remove-tags/#findComment-811133
Share on other sites

It might be easier if you use html_entity_decode on the string then do a replace of the actual tags instead of having to use the entity version.

 

Since you have many tags that you do not want filtered out, strip_tags probably would not work for you. Anyhow, hope that helps you get it sorted easier/better.

 

As far as a simpler way, I do not think there is, but that might make it cleaner since it will be <b> instead of & ...etc

Thanks for the help...definitely pushed me in the right direction.

Link to comment
https://forums.phpfreaks.com/topic/154287-solved-remove-tags/#findComment-812472
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.