note 38871 added to function.feof

From: Date: Fri, 09 Jan 2004 16:53:41 +0000
Subject: note 38871 added to function.feof
Groups: php.notes 
Request: Send a blank email to php-notes+get-63212@lists.php.net to get a copy of this message
We can look for a match till to the end of a text file. <?php $read="a_string"; $count =0; if (!$file_open = fopen("agents.txt","r")) { echo "oops! I did not find this file"; } else { while(!feof($file_open)) { $count++; $line = fgets($file_open, 255); $line=(trim($line)); if ( $line == $read ){ echo "Rated $count ! $line"; $match=$line;} } if (@$match ==""){ echo "Sorry No Match";} fclose($file_open); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.feof.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38871 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38871&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38871&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63212) next »