[ciapug] preg_replace question.
Dave J. Hala Jr.
ciapug@cialug.org
07 Sep 2004 13:31:17 -0500
That's an old function, it has been replaced with str_replace.
Try this:
$string = '123 45 6789';
$look_for = ' ';
$replace_with = '';
$new_string = str_replace($look_for,$replace_with, $string);
Here's a link for more options:
http://us4.php.net/manual/en/function.str-replace.php
On Tue, 2004-09-07 at 13:17, Chris Hettinger wrote:
> I had this working at one point, but now it's not... not sure what's
> changed.
>
>
> $string = '123 45 6789'
>
> // Should remove 'any whitespace' character
> $string2 = preg_replace("/\s/", "", $string);
>
> echo $string2
> // Should be 123456789.
> // Im getting 123 45 6789
>
>
> However, recently, this is NOT doing anything. Did I mess up the syntax?
>
> -ch
>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
--
OSIS
Dave J. Hala Jr.
641.485.1606