Jump to content

Archived

This topic is now archived and is closed to further replies.

iainlang

how to change everything in a string?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
should be able do that easily with str_replace
[code]$str = "This has,commas,init";

$str = str_replace(',', ' ', $str);

echo $str;[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.