Re: storing an array in an ini file

From: Date: Tue, 13 Apr 2004 22:40:16 +0000
Subject: Re: storing an array in an ini file
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-183268@lists.php.net to get a copy of this message
* Thus wrote David T-G (davidtg-php@justpickone.org): > Curt, et al -- > > ...and then Curt Zirzow said... > % > % * Thus wrote David T-G (davidtg-php@justpickone.org): > % > > % > I have an ini file for my application and I use parse_ini_file to load it > % > and some custom code to save modifications. I'd like to figure out how > % > to store array values in there since that is the logical place to keep > ... > % > % You could always serialize the array to a value. and unserialize it > % after the call to parse_ini_file(). > > I thought about that, but what I'm really after is not having to do any > special processing for a variable -- both because it makes special cases > and because then I'd have to reserialize it if I were to write out a > change. My other though, which I probably should have mentioned, was to patch php's ini handling to allow for something like [Section] var[1]=element1 var[2]=element2 ... Thus the results would be something like Array ( [Section] => Array ( var => Array ( [1] => element1 [2] => element2 ) ) ) I dont know if [] characters are valid in keys Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#183268) next »