try this out $words = explode(" ", $keywordText); $compare = array('on', 'the', 'in', 'at', 'is', 'it'); foreach ($words AS $value) { if (in_array($value, $compare)) { $ignored[] = $value; } else { $included[] = $value; } }
Jim Lucas ----- Original Message ----- From: "Sam" <[EMAIL PROTECTED]> To: "'php'" <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 8:17 AM 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]