I want to search for a word in a list of files (a search engine). However, I don't know if a file is text or binary.
In fact, I already have this script in perl and I am porting to php. In perl, I use:
if(-T $filename)
{
push(@file_list,$filename);
}
inside a loop. In php, I tried:
if(filetype($filename) == "char")
{
$file_list[] = $filename;
}
But it didn't work, and I found out it's because filetype() returns "file" in my test files. 🙁
Any suggestions?
Thanks in advance.