This function removes a line from a text file list. It has one problem if
it removes a line from the beginning or middle of the text file list
it leaves a blank line. How can I make it remove the blank line also?

function remove_email($email){
global $members,$datadir,$email;
$recordsarray = file($members);
$temp = array();
for ($i=0;$i<count($recordsarray);$i++)
{
  if (!strstr($recordsarray[$i], $email))
  {
    $temp[] = $recordsarray[$i];
  }
}
$recordsarray = $temp;
$lines = implode('',$recordsarray);
$fp = fopen($members, "w");
fwrite($fp, $lines, strlen($lines));
fclose($fp);
}

  

-- 
Best regards,
 Richard                          mailto:[EMAIL PROTECTED]


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

Reply via email to