note 79484 deleted from function.fwrite by tularis
| From: | tularis@php.net | Date: | Fri, 30 Nov 2007 12:18:02 +0000 |
| Subject: | note 79484 deleted from function.fwrite by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-132689@lists.php.net to get a copy of this message | ||
Note Submitter: Leonardo Morelli
----
I was having problems writing a newline with fwrite. I used "\n" correctly, or at least I
thought so, but when reading the file I discovered that the newline character wasn't written,
but the string "\n" instead.
What solved the problem was concatenating the "\n" to the string instead of leaving it
inside the larger quotes. examples:
//this would DO IT WRONG:
fwrite($file, "omfg! Where is the newline?\n");
//this, however, did put the newline in place:
fwrite($file, "Great! Now I can continue working!"."\n");
go figure. I hope it helps.