PHP mbstring.func_overload vs using mbstring functions [duplicate]

佐手、 提交于 2019-12-08 04:07:37

问题


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.


回答1:


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)?



来源:https://stackoverflow.com/questions/1647419/php-mbstring-func-overload-vs-using-mbstring-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!