Hi Shawn,

Your code looks cleaner then mine so i tried it and got the last entry in the txt file printed twice.


On Nov 30, 2009, at 7:07 AM, Shawn McKenzie wrote:

aurfal...@gmail.com wrote:
So here is my final test code, notice the check for ' ' in the if.

Since I'm on Linux, this has to do with whats between the last LF and
EOF which is nothing but this nothing will get printed out.

$file = fopen("somefile.txt", "r");
while (! feof($file))
   {
     $tmp = trim(fgets($file));
     if ($tmp != '')
       {
         $names = $tmp;
       }
   print $names."sometext\n";
   }
fclose($file);



--
Thanks!
-Shawn
http://www.spidean.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to