note 29094 deleted from function.str-replace by nlopess
| From: | nlopess@php.net | Date: | Sun, 11 Jan 2004 09:55:04 +0000 |
| Subject: | note 29094 deleted from function.str-replace by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63307@lists.php.net to get a copy of this message | ||
Note Submitter: daniel@swn
----
This case insensitive one should work with arrays, too ;)
---
function stri_replace ($search,$replace,$text)
{
if (!is_array($search))
{
$search = array($search);
$replace = array($replace);
}
foreach($search AS $key => $val)
{
$search["$key"] = '/'.quotemeta($val).'/i';
}
return preg_replace($search,$replace,$text);
}