note 79484 added to function.fwrite

From: Date: Thu, 29 Nov 2007 14:02:06 +0000
Subject: note 79484 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-132664@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 201.43.56.235 ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- https://master.php.net/note/edit/79484 Del: integrated -- https://master.php.net/note/delete/79484/integrated Del: useless -- https://master.php.net/note/delete/79484/useless Del: bad code -- https://master.php.net/note/delete/79484/bad+code Del: spam -- https://master.php.net/note/delete/79484/spam Del: non-english -- https://master.php.net/note/delete/79484/non-english Del: in docs -- https://master.php.net/note/delete/79484/in+docs Del: other reasons-- https://master.php.net/note/delete/79484 Reject -- https://master.php.net/note/reject/79484 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132664) next »