note 96622 added to function.fgets

From: Date: Mon, 08 Mar 2010 20:01:35 +0000
Subject: note 96622 added to function.fgets
Groups: php.notes 
Request: Send a blank email to php-notes+get-166799@lists.php.net to get a copy of this message
I try to join 3 lines from a text file using $Txt.=fgets($file)." ".fgets($file)." ".fgets($file)."\n " but it outputs them as 3 lines. Only after hours of pulling my hair out, i realize there is a linefeed at the start of each original line. So, this works: $Txt.=chop(fgets($file))." ".chop(fgets($file))." ".chop(fgets($file))."\n " Is there another more elegant way? ---- Server IP: 69.147.83.197 Probable Submitter: 60.225.34.90 ---- Manual Page -- http://www.php.net/manual/en/function.fgets.php Edit -- https://master.php.net/note/edit/96622 Del: integrated -- https://master.php.net/note/delete/96622/integrated Del: useless -- https://master.php.net/note/delete/96622/useless Del: bad code -- https://master.php.net/note/delete/96622/bad+code Del: spam -- https://master.php.net/note/delete/96622/spam Del: non-english -- https://master.php.net/note/delete/96622/non-english Del: in docs -- https://master.php.net/note/delete/96622/in+docs Del: other reasons-- https://master.php.net/note/delete/96622 Reject -- https://master.php.net/note/reject/96622 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166799) next »