note 29094 added to function.str-replace

From: Date: Sat, 01 Feb 2003 21:43:01 +0000
Subject: note 29094 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-43278@lists.php.net to get a copy of this message
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); } -- http://www.php.net/manual/en/function.str-replace.php http://master.php.net/manage/user-notes.php?action=edit+29094 http://master.php.net/manage/user-notes.php?action=delete+29094 http://master.php.net/manage/user-notes.php?action=reject+29094

« previous php.notes (#43278) next »