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 Quote 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); Quote 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] Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.