Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.