Possible Duplicate:
PHP syntax for dereferencing function result
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.
when i got to the site I get this error
Parse error: syntax error, unexpected '[' in /home/content/51/6663351/html/application/controllers/admin.php on line 247
line 247 is
if(count($results->result()) > 0)
{
this here>>> $data['data'] = $results->result()[0];
$data['cats'] = $this->db->get('category')->result();
$data['curCat'] = $this->db->get('products_categories', array('product_id' => $id))->result()[0];
so I tried changing the code to:
$data = array();
if(count($results->result()) > 0)
{
$data['data'] = $results->result()[0];
$data['cats'] = $this->db->get('category')->result();
$data['curCat'] = $this->db->get('products_categories', array('product_id' => $id))->result()[0];
how ever adding the $data = array(); didn't fix anything. Does anyone have an idea what is wrong?