Split long words in a text

Recursive php function, to split long words:

/**
 * Cut words to max char, in a text
 *
 * @param    string text        Text to check
 * @param    integer maxChar    Max word length
 * @return   string             Verified text
 */
function checkWordLength($text, $maxChar=50) {

    $arrText = explode(' ', $text);
    foreach ($arrText as $key=>$t) {
      if (strlen($t)>$maxChar) {
        $arrText[$key] = chunk_split($t, $maxChar, ' ');
      }
    }

    return implode(' ', $arrText);
}

Use:

$text = checkWordLength($text);

About

This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.