|
From: Alex B. <en...@tu...> - 2001-08-13 18:46:22
|
> I've moved this from dev since its a "duh" question. I've seen this type of
> structure all over r2 and can't seem to grasp the
> logic:
>
>>>>>
> $modXSettings = array(
> "foo" => array(
> "name" => "Peter",
> "other" => "Pan"
> ),
> perms => "god"
> );
>>>>>
>
> Would someone be willing to explain what's going on here and why? An array
> within an array, I can see the usefulness in that I *think*, but a such a
> complex matrix hardly seems ubiquitously useful as this structure is
> referenced in r2.
It's a nested hierarchy.
Think of it as xml:
<modXSettings>
<foo>
<name>Peter</name>
<other>other</other>
</foo>
<perms>god</perms>
</modXSettings>
It is the most efficient way to store a set of data, i.e. in one variable
that has some defined structure.
You reference it with:
$modXSettings['foo']['name']
etc
best,
_alex
|