Page 1 of 1

Parsing conf file.

Posted: Thu Mar 20, 2008 1:50 pm
by luuno
I'm a total noob concerning php and i would appreciate some help. I need to read and parse config file and save values to array of arrays. My problem is how to parse it. Conf file looks like this:

//some comments...
//some comments...
.
.
.
variable_name=variable_value

//some comments
//some comments
.
.
.
variable_name=variable_value

and so on (n times).

I need to read this file and store these three values (comments,name,value) for every variable in array ($arr1 = array ("arr2" => array ("name","value","comments"))).

Any help is welcome. Thank you.

Re: Parsing conf file.

Posted: Thu Mar 20, 2008 1:56 pm
by Zoxive
What time of config file is this?

Whats wrong with just a normal php file with your config data.

Or even use php's style of config file a .ini file?

parse_ini_file

Re: Parsing conf file.

Posted: Thu Mar 20, 2008 1:59 pm
by luuno
This is a configuration file for a search engine which runs on linux (so the file is something like name.conf). It is a pure textual file. ini file can't be used for different reasons.