I need to search in my files
| From: | William Stark | Date: | Fri, 22 Nov 2002 18:40:12 +0000 |
| Subject: | I need to search in my files | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-91464@lists.php.net to get a copy of this message | ||
Hi everyone,
I need to search for a string in all the html files of a directory.
The problem is that i have to program this to be multi-plattform, so i cant
use linux commands.
I cant find any PHP native function to do this easily.
What can i do?
I thought about going like this...
/*read all files to an array*/
foreach($files as $file)
{
$fp=fopen($file,filesize);
$file_string=fread($fp,filesize);
/*search for the string in $file_string*/
if <found> {return xxx; exit;}
fclose($file);
}
but i dont like this... it sounds slow and not proffessional...
any ideas?
Thank u all.
William Stark