eregi_replace isn't your problem this funciton "RETURNS" the new string.
> function scan_string(&$str) {
> $forbid = array ("coke", "tylenol", "ford");
> $swap = array ("pepsi", "advil", "chevrolet");
> for ($i = 0; $i < count ($forbid); $i++) {
> $NEW_STRING = eregi_replace($forbid[$i],$swap[$i],$str);
> }
> return($NEW_STRING);
> }
Jim
----- Original Message -----
From: "phantom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 16, 2001 2:16 PM
Subject: [PHP] eregi_replace probs
> function scan_string(&$str) {
> $forbid = array ("coke", "tylenol", "ford");
> $swap = array ("pepsi", "advil", "chevrolet");
> for ($i = 0; $i < count ($forbid); $i++) {
> eregi_replace($forbid[$i],$swap[$i],$str);
> }
> }
>
> I run this script, and I know the array's load up and the for...do loop
> runs ok. As does the passing variable ($str).
>
> I enter a test script such as "I like coke." and my returned value
> remains "I like coke."
>
> It appears the eregi_replace is the problem.
>
> Any idea why?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]