clarkk clarkk - 3 months ago 9
PHP Question

stristr with special chars æøåü etc

Why is this not a match?

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

Answer

Use mb_* functions because they can operate on multi byte characters. PHP's strings are really byte arrays. They don't know what a character is.