robthemanbob Posted January 3, 2008 Share Posted January 3, 2008 I am creating a XML RSS feed with php while pulling information from the dabase in a while $row loop I need to use a preg_replace to remove a "&" from the database pull I have tried utf8_encode($pagefile); $patterns[0] = ' & '; $replacements[0] = '&'; str_replace($patterns, $replacements, $pagefile); with no luck. Any advice would be fantastic Link to comment https://forums.phpfreaks.com/topic/84331-preg_replace/ Share on other sites More sharing options...
effigy Posted January 3, 2008 Share Posted January 3, 2008 It sounds like you need to use the proper tool for creating the XML. How is this being done--some code perhaps? Link to comment https://forums.phpfreaks.com/topic/84331-preg_replace/#findComment-429503 Share on other sites More sharing options...
dsaba Posted January 6, 2008 Share Posted January 6, 2008 <?php #preg_replace echo preg_replace('~&~', '', 'hello w&orld'); #str_replace echo str_replace('&', '', 'hello w&orld'); ?> Link to comment https://forums.phpfreaks.com/topic/84331-preg_replace/#findComment-431661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.