Here I have come out with a possibly very useful wordwrap code snippet.
Apparently what this piece of code does is: it takes the entered text and looks for words longer than the defined ‘$chunk_length’ if it finds any, it splits the long words and then it concatenates the whole string back to a new string with longer words separated by a dash character in this case.
After it has accomplished this task it then inserts an HTML line break after a specified ‘$line_length’ (Depending on your containers width requirements)
<?php
function explode_wrap($text, $chunk_length, $line_length){
$string_chunks = explode(' ', $text);
foreach ($string_chunks as $chunk => $value) {
if(strlen($value) >= $chunk_length){
$new_string_chunks[$chunk] = chunk_split($value, $chunk_length, ' - ');
}else {
$new_string_chunks[$chunk] = $value;
}
}$new_text=implode(' ', $new_string_chunks);
return wordwrap($new_text, $line_length, '<br />');
}?>