Mega Code Archive

 
Categories / Php / File Directory
 

Read in and perform operations on a file line by line

<? $fd = fopen("test.txt", "r"); while(!feof($fd)) {   $line = fgets($fd, 4096);   if(strcmp($line,$targetline) == 0) {      echo "A match was found!";   } } fclose($fd); ?>