Replace

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Replace

Post by Parody »

Is there a function that replaces things in a variable?

To replace lol with laugh for example?

Thanks
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post 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;
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

Thanks :)
Post Reply