Try: $string = file_get_contents( "test.text" );$string = file_put_contents( "test.text", preg_replace( "/(\r\n|\r|\n)(\s)*(\r\n|\r|\n)/", "$1", $string ) );
Boysenberry boysenberrys.com | habitatlife.com | selfgnosis.com On Dec 27, 2005, at 3:16 PM, Christopher Deeley wrote:
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.Thanks
--------------------------------------------------------------------- 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: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx