Page 1 of 1

Directory / File Searching

Posted: Wed Nov 19, 2003 5:06 am
by Riau
Hi,

I'm currently working on a project that requires me to use PHP to handle and read INI files...I only started learning PHP at the beginning of the week, and I have encountered a problem. I need a way to search a directory full of INI files for a specific string in one of the files, and I'm not sure how to go about this. As far as I know, all of the INI's are going to have to be parsed to be searched...I can handle that, I'm just not sure how to go about the searching itself.

A search of the PHP Manual hasn't offered many hints so far...

I'd be grateful for any ideas and assistance.

Posted: Wed Nov 19, 2003 6:32 am
by JayBird
have a look at this in the manual

http://se.php.net/manual/en/function.strstr.php

Mark

Posted: Wed Nov 19, 2003 6:49 am
by Riau
Thanks. That helps with the searching. Another thing...how do I tell PHP to search all the INI's in the directory...would i need readdir for that? Seems simple...but I don't know how to do it :/

Posted: Wed Nov 19, 2003 7:28 am
by Nay
http://php.net/opendir

use opendir(), then readdir() and in the loop, you can read each file. Anyhow, you can read the comments from other users on the functions, you'll learn a lot from them.

-Nay

Posted: Wed Nov 19, 2003 9:09 am
by Riau
Thanks for the help :D