I develop in codeigniter. My program'll automaticly create it database, so i create for every table a createScheme() method. I try to call all these method like this:
public function createDB()
{
$tables = array('user', 'manufacturer', 'device');
foreach ($tables as $i => $table) {
$this->load->library($table);
$this->{$table}::createScheme();
}
}
This is create an error:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /var/www/clients/client0/web79/web/application/controllers/welcome.php on line 22
How can i do it?
T_PAAMAYIM_NEKUDOTAYIM is Hebrew, and it refers to PHP’s scope resolution operator (“::”). If you get this message, it means PHP sees a class name and expects you to access it with the scope resolution operator.
So createScheme() is not a static, but a normal class method.
Use
$this->{$table}->createScheme();