note 53746 deleted from function.str-ireplace by aidan
| From: | aidan@php.net | Date: | Sun, 24 Jul 2005 04:17:32 +0000 |
| Subject: | note 53746 deleted from function.str-ireplace by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92361@lists.php.net to get a copy of this message | ||
Note Submitter: Andrew Cassidy andee at bytz dot co dot uk
----
My earlier posted example could actually probably be modified to include the count parameter.
I'll look into that later, but here's what I think it should look like.
<?php
function str_Ireplace($search, $replace, $subject, $count=null) {
if (is_array($search)) {
foreach ($search as $word) {
$words[] = "/".$word."/i";
}
}
else {
$words = "/".$search."/i";
}
return preg_replace($words, $replace, $subject, $count);
}
?>