Removing a Blank line from a text file

From: Date: Tue, 11 Mar 2003 01:03:39 +0000
Subject: Removing a Blank line from a text file
Groups: php.general 
Request: Send a blank email to php-general+get-139054@lists.php.net to get a copy of this message
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:rdkurth@starband.net

« previous php.general (#139054) next »