PDA

View Full Version : Replacing words problem


007
03-13-2003, 08:50 PM
I am trying to make something that replaces certain words:

I tried:

$bbcode=strtolower(str_replace(trim("word"),"replacementword",$bbcode));

The reason the strtolower was in case somebody uses "wOrd" or "WORd" etc. But the problem is now every message is in lowercase.

Is there another way to do this?

I then tried:

if ($bbcode == strt("word")) {
$bbcode = strtolower("replacementword");
}

Something about that brought up the dreaded white error page.

What am I doing wrong? Or is there another way to do this? Thanks.

amykhar
03-13-2003, 08:53 PM
Try this:


$bbcode=str_replace(trim("word"),"replacementword",strtolower($bbcode));

mr e
03-13-2003, 09:20 PM
strt isn't a php function

007
03-13-2003, 09:23 PM
*sighs*

Ooops, I did use str (which is a PHP funciton) but typed it wrong up there. Sorry. :speechless:

And Amy, that still didn't work, now every post is entirely in lowercase still... :ermm:

amykhar
03-15-2003, 01:05 PM
006, I got it.

See the text file here:

https://vborg.vbsupport.ru/showthread.php?s=&threadid=50116

It has the function you need called stri_replace.

Funny the things google can find for you :D

Amy

007
03-15-2003, 08:03 PM
Oh, :) I saw that but I had already fixed it. I searched around here at VBorg and found it. Amazing what searching here can do for you too :) Thanks.

;)