
Jase - 2010-07-28 13:13:07
Hi
Looking through the class, I can't help but notice that in some cases, either iconv or mb_string functions should be used. They are very easy to check for if they are installed and will deliver significant speed improvements
I've also noticed the reliance on strlen. This is very dangerous when considering that mb_string functions can overload some native string functions like strlen. You should really check to see if strlen is overloaded and if it is, then use mb_strlen(str, '8bit'); (overloading implies the mb functions are available anyways)
Obviously your custom manipulation works great but the strlen issue could be a problem. Maybe build on this current code to make it more robust? In cases that the mb or iconv functions can be used, then use them for significant speed improvements
please be advised that I'm well aware mb and iconv isn't installed on all servers but I'm suggesting them as a first port of call (check if they are installed, if not, your custom functionality would be the fallback) and obviously is mb_strlen isn't installed then strlen should carry on fine.