PHP mbstring.func_overload vs using mbstring functions [duplicate]
I want to conform my site's string handling to support other languages per UTF-8. It seems that the best way to do this is to forsake all the standard string functions.
So I have two options, I can set the mbstring.func_overload
option in php.ini or I can go back over my code and just replace all the functions with mb_*
. I would assume that the second option will be easier on people using my code as they won't have to change their sever config. (if they even can!)
What about when PHP 6 comes out? Should that have any baring on my choice since it will support proper multibyte processing.
I believe the argument against mbstring.func_overload
is that if you use any 3rd party libraries/code whatsoever, that code may be relying on the "normal" functionality of the functions in question -- e.g., it may be calling substr() to truncate a string containing binary data at an exact byte boundary, or using strlen() to get length in bytes, rather than length in UTF-8 characters.
See also: Should I use multi-byte overloading (mbstring.func_overload)?
精彩评论