parsing ini files
| From: | Erich C. Beyrent | Date: | Tue, 28 Jan 2003 15:00:37 +0000 |
| Subject: | parsing ini files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133368@lists.php.net to get a copy of this message | ||
Hey everybody,
I'm new the list and to PHP, so I thought I'd launch right in with a
question.
I have a file which contains the following syntax:
; Events listings
[event]
month = january
day = 23
year = 2003
venue = some club
description = this is an event
[event]
month = january
day = 12
year = 2003
venue = another club
description = this is another event
Each one of these headers sections represents the start of a new event. So,
my code does the following:
$EVENTS = parse_ini_file('./data/events', TRUE);
while($key = key($EVENTS))
{
$$key = current($EVENTS); //variable variables
next($EVENTS);
}
The problem is that when I try to print the values for $venue, $day, etc, I
only get the values for the last section encountered. I need a way to get
the values of all the events - do my section heads need to be unique, or can
I continue to use the same format in my ini file?
Thanks in advance!
-Erich-