public function test_replace_linefeed_search() { $str = "Iñtërnâtiônàli\nzætiøn"; $replaced = "Iñtërnâtiônàlisetiøn"; $this->assertEquals($replaced, u::str_ireplace("lI\nzÆ", 'lise', $str)); }
/** * This function returns a string or an array with all occurrences of search in subject (ignoring case) replaced with the given replace value. * @param mixed $search String or array of strings to be found. * @param mixed $replace String or array of strings used for replacement. * @param mixed $subject String or array of strings being searched. * @param int $count (optional) The number of matched and replaced needles will be returned in count, which is passed by reference. * @param string $encoding (optional) The used internally by this function character encoding. * If it is omitted, the platform character set will be used by default. * @return mixed String or array as a result. * Notes: * If $subject is an array, then the search and replace is performed with every entry of subject, the return value is an array. * If $search and $replace are arrays, then the function takes a value from each array and uses it to do search and replace on subject. * If $replace has fewer values than search, then an empty string is used for the rest of replacement values. * If $search is an array and $replace is a string, then this replacement string is used for every value of search. * This function is aimed at replacing the function str_ireplace() for human-language strings. * @link http://php.net/manual/en/function.str-ireplace * @author Henri Sivonen, mailto:hsivonen@iki.fi * @link http://hsivonen.iki.fi/php-utf8/ * Adaptation for Chamilo 1.8.7, 2010 * Initial implementation Dokeos LMS, August 2009 * @author Ivan Tcholakov */ function api_str_ireplace($search, $replace, $subject, &$count = null, $encoding = null) { return Utf8::str_ireplace($search, $replace, $subject, $count); }