Because the key 'data' is not unique, the config will overwrite it for each element and you end up with only the key 'data' and the value '3' in your config.

If you wanted a multidimensional array you need to supply unique key names:-

e.g.

<data>
    <live>
        <arrays>
            <data_1>1</data_1>
            <data_2>2</data_3>
            <data_3>3</data_3>
        </arrays>
    </live>
</data>

You're out of luck if you wanted a numeric index for your array. Perhaps as a workaround you could perform an $array = array_values($config->arrays->data->toArray());

On 6/25/07, Andreas Sundqvist <[EMAIL PROTECTED]> wrote:
Hi

I was wondering why you can't get an multi dimension array out of the config
object

if I have this config:
<data>
 <live>
   <arrays>
     <data>1</data>
      <data>2</data>
      <data>3</data>
 </live>
</data>

and do this:

$config = new Zend_Config(new Zend_Config_Xml('config.xml',"live"));

Why is this not enough?
$config = new Zend_Config_Xml('config.xml','live');

Till

--

Simon Mundy | Director | PEPTOLAB

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com


Reply via email to