<p>I am trying to create a multi dimensional array using this syntax:</p>

<pre><code>$x[1] = 'parent';
$x[1][] = 'child';
</code></pre>

<p>I get the error: <code>[] operator not supported for strings</code>  because it is evaluating the <code>$x[1]</code> as a string as opposed to returning the array so I can append to it.</p>

<p>What is the correct syntax for doing it this way? The overall goal is to create this multidimensional array in an iteration that will append elements to a known index.</p>

<p>The syntax <code>${$x[1]}[]</code> does not work either.</p>

```
```
$x = array();
$x[1] = array();
$x[1][] = 'child';
```
```