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