<?php
echo "<form>
<input type=text size=20 name=s_entry>
<input type=submit value=search>
</form>";
if ($s_entry == ""){
echo "you must enter a search word";
} else {
$c ="$s_entry";
// Read the entire file into the variable $file_contents
$searchword=$c;
$filename = 'data\data.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
// Place the individual lines from the file contents into an array.
$lines = explode ( "\n", $file_contents );
// Split each of the lines into the fields
// and attempt to match them to the search word
foreach ( $lines as $line ) {
list( $PEN, $SURNAME, $DOB) = explode( '|', $line );
if ( $c == "$PEN" ) {
echo "Found $PEN <br> $line";
}
elseif ( $c == "$SURNAME" )
echo "Found $SURNAME <br> $line";
elseif ( $c == "$DOB" )
echo "Found $DOB <br> $line";
else
echo "";
}
}
?>
Only issue is performance. what kind of performance can i expect with this for searching a file that has over 76,000 lines?