I have a class for Codeigniter
with a property $keywords
that I want to assign with the function set_keywords()
class Seo
{
private $keywords = array();
public function set_keywords($keywords)
{
$this->$keywords = $keywords;
}
}
And in my controller:
public function index()
{
$this->load->library('seo');
$keywords = array('hola','mundo');
$this->seo->set_keywords($keywords);
$this->load->view('inicio_view');
}
I get the error
Array to string conversion
And I have no idea what the problem is.