我需要在俄语文本中突出显示搜索结果,但是当查询具有不同大小写时,str_ireplace() 就无法正常工作。我已经尝试了手册中的所有方法manual,但没有任何效果。这是我尝试过的内容:
<?php
setlocale (LC_ALL, 'ru_RU');
$query = 'ПрОбЛеМа';
$result = 'Эта проблема нам не знакома.';
$result = str_ireplace($query, "<strong>$query</strong>", $result); // does not work
$result = preg_replace("/($query)/i", '<strong>$1</strong>', $result); // does not work
$result = mb_eregi_replace("$query", "<strong>$query</strong>", $result); // does not work
$result = ext_str_ireplace($query, "<strong>$query</strong>", $result); // from php.net - does not work
$result = highlightStr($result, $query); // from php.net - does not work
?>
有没有办法让它工作?我现在感到绝望。
PHP 5.3.3