Possible Duplicate:
Access array returned by a function in php
I have a function in a class which returns an array of data for a single item.
public function retrieveItemData($item_id) {
$stmt = parent::query("SELECT title FROM `item_main` WHERE `item_id` = $item_id");
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) :
$item = array(
'id' => $item_id,
'title' => $row['title'],
'url' => $item_id . '/' .$this->generate_seo_link( $row['title'], '-')
);
endwhile;
return $item;
}
elsewhere in the class i call the function like so
$this->return .= '<td>' . $this->retrieveItemData($rep['source']) . '</td>';
$this->retrieveItemData($rep['source'])
is obviously printing 'Array', how can i access the title key from here?
I have tried
$this->retrieveItemData($rep['source'])['title']
And
$this->retrieveItemData($rep['source'])->title
But with no luck.