Stristr with special characters æøåü, etc.

Why is this not appropriate?

http://www.tehplayground.com/#UREUvT4yr

$str = 'Bülow';

if(stristr($str, 'BÜLOW')){
    echo 'match';
}
else{
    echo 'no match';
}

Update

same problem with strtolower

echo strtolower('BÜLOW'); // returns: bÜlow
+4
source share
1 answer

Use mb_*functions ( mb_stristr) because they can work with multiple byte characters. PHP strings are really byte arrays. They do not know what a character is.

+1
source

Source: https://habr.com/ru/post/1650824/


All Articles