php t_array error
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/742764/php-syntax-for-dereferencing-function-result">PHP syntax for dereferencing function result</a>  </p>
</blockquote>



<p>i wrote some code in php 5.4 and my server can only run 5.3,thus i have some syntax errors i need to fix.</p>

<p>when i got to the site I get this error</p>

<pre><code> Parse error: syntax error, unexpected '[' in /home/content/51/6663351/html/application/controllers/admin.php on line 247
</code></pre>

<p>line 247 is </p>

<pre><code>if(count($results-&gt;result()) &gt; 0)
            {
 this here&gt;&gt;&gt;   $data['data'] = $results-&gt;result()[0];
                $data['cats'] = $this-&gt;db-&gt;get('category')-&gt;result();
                $data['curCat'] = $this-&gt;db-&gt;get('products_categories',     array('product_id' =&gt; $id))-&gt;result()[0];   
</code></pre>

<p>so I tried changing the code to:</p>

<pre><code> $data = array();
 if(count($results-&gt;result()) &gt; 0)
            {
                $data['data'] = $results-&gt;result()[0];
                $data['cats'] = $this-&gt;db-&gt;get('category')-&gt;result();
                $data['curCat'] = $this-&gt;db-&gt;get('products_categories', array('product_id' =&gt; $id))-&gt;result()[0];
</code></pre>

<p>how ever adding the $data = array(); didn't fix anything. Does anyone have an idea what is wrong?</p>
