303tech Posted March 27, 2007 Share Posted March 27, 2007 I'm having problems when the string has &'s in it, as well as 's. I was able to remove the 's. But i get a return value of 0 when trying to do the same thing with &'s. If i take out the part where I'm trying to remove &, the value of $replace is OK. //PARSE INI FILE. $ini = parse_ini_file('config.ini'); //REMOVE APOSTROPHES FROM NAME. $and="&"; $ini1=$ini['UNITNAME']; $unitname=str_replace($and,"AND",$ini1); echo $unitname; $replace=str_replace("'","",$unitname); echo $replace; Also, is there a way that I can put chars like this in db fields? Link to comment https://forums.phpfreaks.com/topic/44559-removing-s-from-parse/ Share on other sites More sharing options...
per1os Posted March 27, 2007 Share Posted March 27, 2007 //PARSE INI FILE. $ini = parse_ini_file('config.ini'); //REMOVE APOSTROPHES FROM NAME. $and="&"; $ini1=$ini['UNITNAME']; $unitname=str_replace('&',"AND",$ini1); echo $unitname; $replace=str_replace("'","",$unitname); echo $replace; Try that. Not sure if it will work but it's worth a shot. Link to comment https://forums.phpfreaks.com/topic/44559-removing-s-from-parse/#findComment-216429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.