Taggon in Happy Life

JavaScript, PHP, jQuery, Mobile and Talk

mb_strlen

Little faster mb_strlen implementation

I found a good code snippet while looking for a mb_strlen fallback implementation. /** * Fallback implementation of mb_strlen, hardcoded to UTF-8. * @param string $str * @param string $enc optional encoding; ignored * @return int */ function new_mb_strlen( $str, $enc=”" ) { $counts = count_chars( $str ); $total = 0; // Count ASCII bytes [...]

, , ,

조금 더 빠른 mb_strlen 구현

mb_strlen mb_strlen

mb_strlen을 구현해야 할 일이 생겨서 검색하던 도중 좋은 코드를 찾았습니다. /** * Fallback implementation of mb_strlen, hardcoded to UTF-8. * @param string $str * @param string $enc optional encoding; ignored * @return int */ function new_mb_strlen( $str, $enc=”" ) { $counts = count_chars( $str ); $total = 0; // Count ASCII bytes for( $i = [...]

, , ,