Today I ran into a problem with the php function strpos()
because it returned FALSE even if the correct result was obviously 0. This was because one parameter was encoded in UTF-8, but the other (origin is a HTTP GET parameter) obviously not.
Now I have noticed that using the mb_strpos
function solved my problem.
My question is now: Is it wisely to use the PHP multibyte string functions generally to avoid theses problems in future? Should I avoid the traditional strpos
, strlen
, ereg
, etc., etc. functions at all?
Notice: I don't want to set mbstring.func_overload
global in php.ini, because this leads to other problems when using the PEAR library. I am using PHP4.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…