httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Robinson <>
Subject Re: [users@httpd] Delete Blank Lines In A Text File
Date Tue, 27 Dec 2005 21:53:34 GMT
Quoting Christopher Deeley <>:

> 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:
    $input = file(''); // read file into the array $input
    $fp = fopen('');
    foreach ($input as $line)
        if (trim($line) != '') fwrite($line);  // if the line isn't blank write
it out


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message