Re: Case-insensitive search and replace using an array

From: Date: Tue, 06 May 2003 19:45:06 +0000
Subject: Re: Case-insensitive search and replace using an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-146556@lists.php.net to get a copy of this message
On Wednesday 07 May 2003 00:41, René Fournier wrote: > $patterns = array("Mr.","Ms.","Mrs.","unknown"); > $piece = str_replace($patterns,"",$piece); > > This code works, but what I'd like to do is change it so that if $piece > contains "Mr." or "mr.", both are caught and replaced. Preg_replace > allows for case-insensitive search items, but I can't seem to combine > that parameter with the $patterns search array. > > Any ideas? Thanks. Yes. RFTM -> str_ireplace() -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* To generalize is to be an idiot. -- William Blake */

« previous php.general (#146556) next »