Re: parsing ini files

From: Date: Tue, 28 Jan 2003 15:22:46 +0000
Subject: Re: parsing ini files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133388@lists.php.net to get a copy of this message
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
interesting function, i had not seen it yet. You could have a look at the alternative function mentioned by the users 'seb' and 'Tom' in the online manual http://nl.php.net/manual/nl/function.parse-ini-file.php, at least you can tweak that so the values get added to arrays. Or you could see whether this will work: [event] month[]=januari [event] month[]=februari I doubt whether it would work, the idea is that in this case $month[0] would be januari and $month[1] februari.
$EVENTS = parse_ini_file('./data/events', TRUE); while($key = key($EVENTS)) { $$key = current($EVENTS); //variable variables next($EVENTS); }
if you ask me, i would do it like this: while (list ($key, $val) = each ($_POST)) { { $$key = $val; }

« previous php.general (#133388) next »