Re: eregi_replace probs
| From: | phantom | Date: | Fri, 16 Nov 2001 22:30:42 +0000 |
| Subject: | Re: eregi_replace probs | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74942@lists.php.net to get a copy of this message | ||
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" <phantom@phantomcougar.com>
> To: <php-general@lists.php.net>
> 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: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >