PHP Add elements to array
<p>The line below commented <code>GOAL</code> creates an error. The error is not displayed (just get a white screen) and I do not have access to php.ini to change the settings. I'm quite sure the error is something along the lines of "can not use [] for reading".</p>

<p>How can I get around this? The keys must be preserved and that doesn't seem possible with array_push.</p>

<pre><code>foreach ($invention_values as $value)
        {
            if( array_key_exists($value-&gt;field_name, $array) )
            {
                //GOAL but creates error: $array[$value-&gt;field_name][] = $value-&gt;field_value;
                //works but only with numeric keys
                array_push($array, $value);             
            }

            else $array[$value-&gt;field_name] = $value;           
        }
</code></pre>

<p>EDIT: code</p>

<p>EDIT2: Actually I think the error is cause I'm dealing with an object an not an array. What is the object equivalent of </p>

<pre><code>$array[$value-&gt;field_name][] = $value ?
</code></pre>
