knoakske@hotmail.com (knoak) wrote in message news:<a5e41e0e.0406170957.68c4b2c9@posting.google. com>...[color=blue]
> I used the upper example,
> but now it breaks everything:
>
> thisisoneverylongwor-
> danditgetsbroken and-
> these are seperate-
> words and get broken-
> as well
>
>
> instead of
>
> thisisoneverylongwor-
> danditgetsbroken and
> these are seperate
> words and get broken
> as well
>
> so if there's a space, there's no need for a
> break with a line.[/color]
Usernotes are great resources. You seem to have missed them. Not
sure, if this is what you wanted:
<?php
$text = <<<EOT
thisisoneverylongwordanditgetsbroken and these are seperate words and
get broken as well
EOT;
//Next line logic from
http://in.php.net/wordwrap#31342
$text = preg_replace ("/([^\s]{15,})/e", "''.wordwrap('\\1', 14,
'-\n', 1).''", $text);
$text = wordwrap($text, 15, "\n");
echo $text;
?>
BTW, please properly snip and quote other messages.
--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com