If you are on linux, then I recommend you use the grep command to search for the string. grep is written in C and is very fast compared to PHP.
If you really want to do it with PHP, then use the opendir command, use the readdir command to get the filename and use fopen to open the file and search for the string.
let me know which method you prefer and post it here, and i can help you with it.
-sridhar