Cannot use string offset as an array in
<p>I have an array $aMethods whose print_r output is this:</p>

<pre><code> Array
 (
     [0] =&gt; Array
         (
             [pattern] =&gt; 
             [return_media] =&gt; 1
             [return_name] =&gt; 
         )

 )
</code></pre>

<p>I'm trying to access 'return_media' with this code:</p>

<pre><code> $iReturnMedia = $aMethods[0]-&gt;return_media;
 echo $iReturnMedia;
</code></pre>

<p>Also, when I tried this:</p>

<pre><code> $iReturnMedia = $aMethods[0]['return_media'];
</code></pre>

<p>I get an error stating: Cannot use string offset as an array in...</p>

<p>But it's not working, $iReturnMedia comes back as blank. Could someone tell me what I'm doing wrong here?</p>

<p>EDIT: $aMethods is set in a foreach loop as such:</p>

<pre><code> foreach ($aMethodList as $sMethodGroup =&gt; $aMethods) { //insert code from above }
</code></pre>
