I'm working on making a site that will translate a given domain name into another "slang" language, such as taking a normal site and turning selected words found in a dictionary into say redneck slang.
Right now i'm having problems because the words I search for to replace can sometimes be within another word, or sometimes aren't translated because of the presence of a period, question mark, quotation mark, etc. This is the code I am currently using:
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
for ($a=0; $a<sizeof($yooper_find); $a++) {
$output = preg_replace("/\b" . $yooper_find[$a] . "\b/", $yooper_replace[$a], $buffer);
}
echo $output;
}
I know that part of my problem is because I am not properly using REGEX to do my replacements but I don't know it well enough and can someone give me a replacement way to use REGEX and exclude and include certain cases?
Other then that I was wondering if anyone knows a faster way to do this, because right now it takes forever.
Thanks in advance, sorry about the long message!