[PHP-DEV] I need to search in my files

2002-11-22 Thread William Stark
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



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] I need to search in my files

2002-11-22 Thread Derick Rethans
On Fri, 22 Nov 2002, William Stark wrote:

 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?

php.net/glob, but this list is not for support questions, you can better 
ask those on the [EMAIL PROTECTED] mailinglist.

Derick

-- 

---
 Derick Rethans   http://derickrethans.nl/ 
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php