views:

1095

answers:

2

Is there a way to specify a one dimensional array in a ini file.

so in my ini I would like to do

someproperty = [array of something]

I am using Zend_Config_Ini config adapter (I prefer ini for base configuration).

+2  A: 
someproperty[] = a
someproperty[] = b
someproperty[] = c
someproperty[] = d
someproperty[] = e

see: http://us.php.net/manual/en/function.parse-ini-file.php#75983

Alister Bulman
And is it possible to do it for multi dimensional (so someproperty values maybe a hash/multidimensional array) ?
Akeem
+1  A: 

You can use separators to make further sub-sections, and they are presented as either another level of objects ($config->some->a) or with $config->toArray(), they can be turned into a multi-level array.

Combining both the above techniques to make arrays, and the separators like so:

some.a[] = a
some.a[] = b
some.b[] = c

will give the results you are looking for.

array('some' => array('a' => array(0 => 'a',
                                   1 => 'b'),
                      'b' => array(0 => 'c')
                     ));
Alister Bulman