Eljay Posted April 16, 2009 Share Posted April 16, 2009 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); </i></B></font></center></ProductDescription><Availability>Usually Ships in 24 Hours</Availability><Price>8.7500</DiscountedPrice><ProductManufacturer>ABC</ProductManufacturer><ProductPrice>18</ProductPrice><Ships>N</Ships><ProductFeatures><ul><li>Ni-Cd Battery Quote Link to comment https://forums.phpfreaks.com/topic/154287-solved-remove-tags/ Share on other sites More sharing options...
premiso Posted April 16, 2009 Share Posted April 16, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/154287-solved-remove-tags/#findComment-811133 Share on other sites More sharing options...
Eljay Posted April 17, 2009 Author Share Posted April 17, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/154287-solved-remove-tags/#findComment-812472 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.