The field that I set on an global array does not persist
<p>On my PHP web-page I have a global array:</p>

<pre><code>$test = array();
</code></pre>

<p>Then I invoke this function:</p>

<pre><code>function f () 
{
    global $test;

    init( $test );
    $test['foo'] // Error: undefined index "foo"
}
</code></pre>

<p>which in turn invokes this function:</p>

<pre><code>function init ( $test )
{
    $test['foo'] = 'bar';
    $test['foo'] // evaluates to'bar'
}
</code></pre>

<p>As you can see, I get an error. The "foo" field that I've added to the array inside <code>init()</code> did not persist. Why does this happen? I thought I was mutating the global <code>$test</code> inside <code>init()</code>, but it seems that I'm not doing that. What's going on here, and how can I set a "foo" field inside <code>init()</code> that persists?</p>
