Hi,
The replaced string is returned by the function. This works.
$str = "test test2";
$str2 = preg_replace('/ /', ',', $str);
If your are doing simple replacements like this you should use
str_replace() it's much faster!
$str = "test test2";
$str2 = str_replace(' ', ',', $str);
- Frank
> How do I use preg_replace to replace a space (" ") with a comma (",")?
>
> i am using:
>
> preg_replace('/ /', ',', $string).
>
> this isn't working.
>
>
> --
> Gerardo S. Rojas
> mailto: [EMAIL PROTECTED]
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php