note 52015 added to function.str-ireplace

From: Date: Mon, 18 Apr 2005 19:35:06 +0000
Subject: note 52015 added to function.str-ireplace
Groups: php.notes 
Request: Send a blank email to php-notes+get-88185@lists.php.net to get a copy of this message
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); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.str-ireplace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52015 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52015&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52015&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52015&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52015&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52015&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52015&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88185) next »