static variable called in function giving error undefined codeigniter php static variable called in function giving error undefined codeigniter php codeigniter codeigniter

static variable called in function giving error undefined codeigniter php


Recommended Method (Based on Security)

Define variables in config.php and access it. This will work like Global Variable

$config['secure_key'] = 'myKey';$this->config->item('secure_key'); # get$this->config->set_item('secure_key', 'NewKey'); # set

Access it like this

$this->$secure_key

As per Comment by cd001

self::$secure_key 

If function

$this->function_name();


Since $secure_key is declared as static inside your class. So it can be accessed using self or className as

self::$secure_key

or

Quiz::$secure_key