iainlang Posted June 19, 2006 Share Posted June 19, 2006 I need to know how to change every comma in a string to a space and i'm not having a lot of luck with strstr() I don't seem to understand. it any ehlp, thanx Link to comment https://forums.phpfreaks.com/topic/12361-how-to-change-everything-in-a-string/ Share on other sites More sharing options...
zq29 Posted June 19, 2006 Share Posted June 19, 2006 strstr() is used to find first occurrence of a string within a string. You will have better luck with str_replace(). You can use it like so: str_replace(","," ",$string); Link to comment https://forums.phpfreaks.com/topic/12361-how-to-change-everything-in-a-string/#findComment-47252 Share on other sites More sharing options...
wildteen88 Posted June 19, 2006 Share Posted June 19, 2006 should be able do that easily with str_replace[code]$str = "This has,commas,init";$str = str_replace(',', ' ', $str);echo $str;[/code] Link to comment https://forums.phpfreaks.com/topic/12361-how-to-change-everything-in-a-string/#findComment-47253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.