Utils/StringUtils.php
/**
     * Split long parts of the string into equal length chunks, multi-byte safe
     *
     * @param $input string to be processed
     * @param string $threshold
     * @param string $glue
     *
     * @return string
     */
Split long parts of the string into equal length chunks, multi-byte safe
@param $input string to be processed
@param string $threshold
@param string $glue

@return string
Split long parts of the string into equal length chunks multi - byte safe @param $input string to be processed @param string $threshold @param string $glue @return string
static public function wrapLongWords( $input, $threshold = '20', $glue = ' ' )
    {
        $tokens = explode( $glue, $input );
        $result = array();
        foreach ($tokens as $str) {
            $mblen = mb_strlen( $str );
            if ($mblen < $threshold) {
                $result[] = $str;
                continue;
            }
            $array = array();
            for ($i = 0; $i < $mblen; $i ++) {
                $array[] = mb_substr( $str, $i, 1 );
            }
            $n   = 0;
            $new = '';
            foreach ($array as $char) {
                if ($n <= $threshold) {
                    $new .= $char;
                } else {
                    $result[] = $new;
                    $new      = '';
                    $n        = 0;
                }
                $n ++;
            }
        }
        return implode( $glue, $result );
    }
static public function wrapLongWords ( $ input , $ threshold = '20' , $ glue = ' ' ) { $ tokens = explode ( $ glue , $ input ) ; $ result = array ( ) ; foreach ( $ tokens as $ str ) { $ mblen = mb_strlen ( $ str ) ; if ( $ mblen < $ threshold ) { $ result [ ] = $ str ; continue ; } $ array = array ( ) ; for ( $ i = 0 ; $ i < $ mblen ; $ i ++ ) { $ array [ ] = mb_substr ( $ str , $ i , 1 ) ; } $ n = 0 ; $ new = '' ; foreach ( $ array as $ char ) { if ( $ n <= $ threshold ) { $ new .= $ char ; } else { $ result [ ] = $ new ; $ new = '' ; $ n = 0 ; } $ n ++ ; } } return implode ( $ glue , $ result ) ; }
Split long parts of the string into equal length chunks, multi-byte safe
 @param $input string to be processed
 @param string $threshold
 @param string $glue
Split long parts of the string into equal length chunks multi - byte safe @param $input string to be processed @param string $threshold @param string $glue