After I got some problems with my function to convert a BB-text into HTML. Long words didn't really fit into the layout and only wordwarp() also added breaks to words which would fit into the layout or destroy the other HTML-tags....
So this is my solution. Only words with strlen() >= 40 are edited with wordwarp().
<?php
function bb2html($bb) {
$words= explode(' ', $bb); foreach ($words as $word) {
$break = 0;
for ($i = 0; $i < strlen($word); $i++) {
if ($break >= 40) {
$word= wordwrap($word, 40, '-<br>', true); $break = 0;
}
$break++;
}
$newText[] = $word; }
$bb = implode(' ', $newText); return $bb;
}
?>