note 38871 deleted from function.feof by didou
| From: | didou@php.net | Date: | Fri, 09 Jan 2004 16:54:29 +0000 |
| Subject: | note 38871 deleted from function.feof by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63213@lists.php.net to get a copy of this message | ||
Note Submitter: manaskmukherjee@frontiersoft.net
----
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);
}
?>