Quoting Christopher Deeley <[EMAIL PROTECTED]>:

Does anyone know how to use PHP to delete blank lines in a text file. I use
a text file to store usernames and passwords but with adding and deleting
users, blank lines appear which returns an undefined offset error when the
'verify user script' tries to read each line of the text file.

Here's a short script:
  <?php
   $input = file('your_input_file.here'); // read file into the array $input
   $fp = fopen('your_output_file.here');
   foreach ($input as $line)
       if (trim($line) != '') fwrite($line);  // if the line isn't blank write
it out
   fclose($fp);
  ?>


Ken


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to