note 71010 added to function.fwrite

From: Date: Wed, 08 Nov 2006 05:01:33 +0000
Subject: note 71010 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-119503@lists.php.net to get a copy of this message
In writing a script that produces .htaccess and .htpasswd files, I discovered that in order to produce a blank line at the end of a file (which is required for the two aforementioned files to be interpreted correctly), you just double up the newline character, i.e.: <? $f = fopen('.htpasswd','w'); fwrite('foo:abc123'."\n"); // yields no trailing blank line. fclose($f); $f = fopen('.htpasswd','w'); fwrite('foo:abc123'."\n"); // DOES yield a trailing blank line. fclose($f); ?> Hope this saves someone else some time. ---- Server IP: 216.194.113.175 Probable Submitter: 69.35.76.248 ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- https://master.php.net/note/edit/71010 Del: integrated -- https://master.php.net/note/delete/71010/integrated Del: useless -- https://master.php.net/note/delete/71010/useless Del: bad code -- https://master.php.net/note/delete/71010/bad+code Del: spam -- https://master.php.net/note/delete/71010/spam Del: non-english -- https://master.php.net/note/delete/71010/non-english Del: in docs -- https://master.php.net/note/delete/71010/in+docs Del: other reasons-- https://master.php.net/note/delete/71010 Reject -- https://master.php.net/note/reject/71010 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119503) next »