Re: n-dimension arrays <-> ini files in PEAR Config
| From: | Bertrand Mansion | Date: | Thu, 04 Dec 2003 10:35:03 +0000 |
| Subject: | Re: n-dimension arrays <-> ini files in PEAR Config | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9292@lists.php.net to get a copy of this message | ||
<crain@fuse.net> wrote :
> I'm unable to get PEAR::Config to convert properly between "inifile" and
> "phparray" storage formats when the data to be stored is a multi-dimensional
> array. Is it possible to do this? Specifically, if I build a
> multi-dimensional array, then write it to an ini file, then read it back
> into an array, the array is corrupted. The code below, a small modification
> to part of /config/docs/inifromscratch.php, demonstrates the problem. The
> array at the end of the process is very different from the array at the
> beginning of the process. I'm wondering if this is a shortcoming of php's
> parse_ini_file(), or if ini files can represent only one-dimensional arrays,
> or if I'm doing something wrong. I'd really like to be able to store a
> multi-dimensional array as an ini file and then reconstitute it, if
> possible.
>
> Thanks in advance,
>
> Andy
Ini files don't support multi-level sections AFAIK.
If I were to support that, it would be a hack and wouldn't probably be
compatible. Use a more capable format if you really need multi levels : php
array, xml.
Bertrand Mansion
Mamasam