note 52014 deleted from function.str-ireplace by betz

From: Date: Mon, 18 Apr 2005 19:41:33 +0000
Subject: note 52014 deleted from function.str-ireplace by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-88188@lists.php.net to get a copy of this message
Note Submitter: Andrew Cassidy andee at bytz dot co dot uk ---- Here is another str_ireplace for PHP4 that accepts arrays as input variables. I also found it easier to follow than the previously mentioned one, which is probably more efficient thatn this method: <?php function str_Ireplace($search, $replace, $subject) { if (is_array($search)) { foreach ($search as $word) { $words[] = "/".$word."/i"; } } else { $words = "/".$search."/i"; } return preg_replace($words, $replace, $subject); } ?>

« previous php.notes (#88188) next »