Source code for file /phputf8/str_ireplace.php
Documentation is available at str_ireplace.php
* @version $Id: str_ireplace.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
//---------------------------------------------------------------
* UTF-8 aware alternative to str_ireplace
* Case-insensitive version of str_replace
* Note: requires utf8_strtolower
* Note: it's not fast and gets slower if $search / $replace is array
* Notes: it's based on the assumption that the lower and uppercase
* versions of a UTF-8 character will have the same length in bytes
* which is currently true given the hash table to strtolower
* @see http://www.php.net/str_ireplace
$lendif =
strlen($replace) -
$slen;
while ( preg_match('/(.*)'.
$search.
'/Us',$lstr, $matches) ) {
$matched +=
$mlen +
$lendif;