Parsing conf file.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
luuno
Forum Newbie
Posts: 2
Joined: Thu Mar 20, 2008 1:36 pm

Parsing conf file.

Post 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.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Parsing conf file.

Post 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
luuno
Forum Newbie
Posts: 2
Joined: Thu Mar 20, 2008 1:36 pm

Re: Parsing conf file.

Post 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.
Post Reply