[PHP] Re: Working with a config file

2006-02-20 Thread Jens Kleikamp

Benjamin Adams wrote:

I'm trying to parse a config file, example of the config is:
[fred]
id=8782
section=s1
years=4
download1=mirror1

[frank]
id=8372
section=s3
years=4
download1=mirror12
download2=mirror2
.
.
.

I want to parse this so I can only call frank or freds data and move id, 
section, years, etc to varaibles.

Can someone give me some help
Thanks
Ben

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


If you´ve a php 5 environment I would recommend the Configuration 
Package of the newly releases ezComponents.


Components overview: http://ez.no/doc/components/overview

Fast, feature-rich and easy to use, hava a look at the tutorial:

http://ez.no/doc/components/view/(file)/1.0/introduction_Configuration.html

-Jens

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



Re: [PHP] Re: Working with a config file

2006-02-20 Thread Paul Scott
On Tue, 2006-02-21 at 00:14 +0100, Jens Kleikamp wrote:
 Benjamin Adams wrote:
  I'm trying to parse a config file, example of the config is:
  [fred]
  id=8782
  section=s1
  years=4
  download1=mirror1
  
  [frank]
  id=8372
  section=s3
  years=4
  download1=mirror12
  download2=mirror2
  .

Config files of this type in PHP anyway, are generally generated by the
PEAR Config package. Luckily for you it works both ways (creating and
reading the files) so its really easy to work with. The Config package
also supports all sorts of nifty features that will make your life
easier working with this file.

HTH

--Paul

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