I have this text file that I pull in and I need to transverse through the
file and assign each value in the file into an array.  The text in the file
is separated by a comma.  I was thinking of something along the lines of
explode but its only for strings and I couldn't get it to work with arrays.
Right now everything in the file is counted as an array.  For example, I
have the word "and" in the file.  Each letter is an array but I want it so
that it pulls in the entire word "and" and not each letter.

The file looks a bit like this:

and,not,it,i,a,c,nope

My function looks like this:

function i_strip_words($line) {
$nline = "";
$file_contents = @file($GLOBALS['exclude_words']);

if ($file_contents) {

 foreach ($file_contents as $nword) {
  $nword = trim($nword);
  $nword = str_replace(",", "\n", $nword);

    foreach ($line as $s_string) {
   if ($nword == $s_string) {
    $line = str_replace("$nword", "", $s_string);
    $line = $nline.line;
   }
  }
   }
}

return $line;
}

Whats a really simple way to do this or is there?  I saw some examples but
they looked really ugly and confusing.

thanks



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

Reply via email to