hi

i am writing a small application where a user enters a phrase in the textfield and i would like to display all the files

present in the root directory which consists of the keyword or keywords entered by the user.

i have used a few comparison functions but i am not getting the expected result.

$my_file = file_get_contents("filename.html");
what ever the user enters whether it is a single word or few words i would like to compare with $my_file in a case

insensitive manner.

can anyone suggest the best method and how to go about.

thanks.

    So you basically want to search a folder for text inside the files? This could get very, very, very expensive, but one method might be using [man]glob/man to get a list of files in that directory, loop through that array, open each file (array item), search that file for string entered, add to a $matches array if found, continue on to next file in array.

    A better option, of course, would be to store the content in a database (such as MySQL) and use fulltext searching.

      Write a Reply...