A small addition:

the code below would make a string, but it would be a single word (no spaces
or other word boundaries).  Use this instead:

$ignored .= " " . $words[$i];

That inserts a space before each additional word.  Unfortunately it also
adds a space at the beginning but you can get rid of that after the
processing is done.

Mike


"Stewart Taylor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> $ignored = "";
>  $include = "";
>
> <snip>
>  {
>   $ignored.= $words[$i];
>  }
>  else
>  {
>   $included.= $words[$i];
>
> -Stewart
> -----Original Message-----
> From: Sam [mailto:[EMAIL PROTECTED]]
> Sent: 25 October 2001 16:18
> To: 'php'
> Subject: [PHP] Making a string from an Array
>
>
> Hi all,
> this may be an easy question, but I'm stuck...
>
> how can this,
>
> $words = explode(" ", $keywordText);
>
> for ( $i = 0; $i < count( $words ); $i++ )
> {
>  if ($words[$i]=="on" OR $words[$i]=="the" OR $words[$i]=="in"
> OR$words[$i]=="at" OR $words[$i]=="is" OR $words[$i]=="it")
>  {
>   $ignored[] = $words[$i];
>  }
>  else
>  {
>   $included[] = $words[$i];
>  }
> }
>
> How can I make $included and $ignored a string instead of an array.
>
> Thanks
> Sam Rose
>
> p.s. Also I'm only on the digest, so if you could reply directly to me as
> well, that would be a bonus.



-- 
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