Re: case-insensitive str_replace
| From: | CC Zona | Date: | Thu, 02 May 2002 22:01:38 +0000 |
| Subject: | Re: case-insensitive str_replace | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95775@lists.php.net to get a copy of this message | ||
In article <20020502210824.78972.qmail@pb1.pair.com>,
dark_panda@hushmail.com (J Smith) wrote:
> Reuben D Budiardja wrote:
>
> > I am in need of a case-insensitive str_replace.<snip>
> >
> > The feature that I use in str_replace is to put the 'search' and
> > 'replace'
> > argument as an array, as described in the documentation for php >= 4.0.5
> > Some people suggested some functions in the archive and documentation, but
> > I cannot find anything that can receive arrays as the arguments.
> preg_replace() can be used with arrays.
Yes, just use the "i" (for "case insensitive") modifier after the closing
regex pattern delimiter:
$patterns=array("/foo/i","/bar/i");
--
CC