views:

29

answers:

1

I use mb_stristr function to detect whether a word exists in string or not but if the word I'm checking for is written in unicode this function always returns false. Even if the word actually exists. If I'm looking for non unicode word it word it works fine. Does anyone know how to solve this problem? Tried the strstr function too but the same result...

Thanks in advance

+1  A: 

You need to make sure that you’re using the correct character encoding. If the character encoding of your string is different from the configured one (see mbstring.internal_encoding and mb_internal_encoding), you can specify it with the fourth parameter of mb_stristr:

string mb_stristr ( string $haystack , string $needle [, bool $part = false [, string $encoding ]] )

Gumbo