Page 1 of 1

Replace

Posted: Thu Jun 30, 2005 3:07 pm
by Parody
Is there a function that replaces things in a variable?

To replace lol with laugh for example?

Thanks

Posted: Thu Jun 30, 2005 3:12 pm
by djot
perhaps you should try http://www.php.net,
http://de3.php.net/manual/en/function.str-replace.php

and while you are there, you should get an overview of all possible string manipulations:
http://de3.php.net/manual/en/ref.strings.php

Code: Select all

$text = "foo bar foo bar foo bar";
$replaced = str_replace("foo", "x", $text);
echo $replaced;

Posted: Fri Jul 01, 2005 10:20 am
by Parody
Thanks :)