You might want to look into wordwrap(), too

www.php.net/wordwrap

---John Holmes...

----- Original Message -----
From: "Analysis & Solutions" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 10:42 AM
Subject: Re: [PHP] counting max word length fails on line brake


> On Wed, May 15, 2002 at 12:49:30PM +0200, andy wrote:
> >
> > test
> > ölakjdfölakjdöfkjaödlfkjöaksdjföl
> >
> > it asumes thtat the word is: test ölakjdfölakjdöfkjaödlfkjöaksdjföl
> >
> >  $word = explode(" ",$string);
>
> Because you're splitting on spaces only.  If you want to split on more
than just
> spaces, you need to use a regular expression split function.
>    $word = preg_split('/\s+/', $string);
>
> That will split on any whitespace character, such as space, tabs, and line
breaks.
> Note, putting in the + makes the expression kind enough to only do one
split in cases
> where more than one space character are next to each other.
>
> Enjoy,
>
> --Dan
>
> --
>                PHP classes that make web design easier
>         SQL Solution  |   Layout Solution   |  Form Solution
>     sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to