<?
  $str="eins zwei drei vier fünf sechs sieben acht neun";
  if (preg_match_all("/\w+/", $str, $matches))
  {
    $words = $matches[0];
    var_dump($words);
  }
?>
viele Grüße,
lallous!

"Ewald Schoeller" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hello
> we want to save every word of a text in an array field.
> we want to solve the problem without "split".
>
> Here's our code:
>
> $str="eins zwei drei vier fünf sechs";
> preg_match("'(\w+)(\s+\w+)*'",$str,$Wort);
>
> $n=count($Wort);
> for($i=0;$i<$n;$i++){echo "$i: $Wort[$i]<br>";}
>
> The result is:
> 0: eins zwei drei vier fünf sechs
> 1: eins
> 2: sechs
>
> it only saves the first and the last word.
> why doesn't it save every single word in one array field?
> can anybody give us the (corrected) code to achieve the desired result?
>
>                 thanks for every answer !!
>
>                         Bruno and Ewald
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to