[PHP] eregi_replace probs

2001-11-16 Thread phantom

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]




Re: [PHP] eregi_replace probs

2001-11-16 Thread Jim Lucas

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]




Re: [PHP] eregi_replace probs

2001-11-16 Thread Jim Lucas

sorry didn't notice the  in the args
you'll want this instead.

 function scan_string($str) {
 $forbid = array (coke, tylenol, ford);
 $swap = array (pepsi, advil, chevrolet);
 for ($i = 0; $i  count ($forbid); $i++) {
  $str = eregi_replace($forbid[$i],$swap[$i],$str);
 }
 }

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]




Re: [PHP] eregi_replace probs

2001-11-16 Thread phantom

oh duh, why is it always the simplest reason.  :)

fixed it and it runs good now.

thank you sir!

Jim Lucas wrote:

 sorry didn't notice the  in the args
 you'll want this instead.

  function scan_string($str) {
  $forbid = array (coke, tylenol, ford);
  $swap = array (pepsi, advil, chevrolet);
  for ($i = 0; $i  count ($forbid); $i++) {
   $str = eregi_replace($forbid[$i],$swap[$i],$str);
  }
  }

 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]