PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Evert Pot's Blog: iconv_substr vs mbstring_substr

Note: This article was originally published at PHPDeveloper on 19 April 8600.
PHPDeveloper

Evert Pot came across an interesting performance issue as he was working through an application that needed to do some string substitutions - the difference between iconv_substr, mb_substr and substr.

While working on an application I ran across a huge bottleneck which I isolated down all the way to the use of the iconv_substr function. If you ever wonder which is better to use, [the benchmark code in the post[ should help your decision.

His results changed quite a bit from machine to machine (and OS/platform to OS/platform) but one statistic stood out on them all - the iconv_substr was slower than mb_substr method....by a lot in one case (about 2100000% slower).