Reputation: 49843
hi i have this simple class for example:
class Asd{
private $_url = $this->config->config['url'];
}
but it doesn't get the config param any clue on how to do that?
How do i call a config param in private var
?
Upvotes: 0
Views: 349
Reputation: 4656
You can do like this :
class Asd {
private $_url;
public function __construct() {
$CI =& get_instance();
$this->_url = $CI->config->config['url'];
}
}
You can't declare class property as you want.
Upvotes: 3
Reputation: 68526
Variables can be assigned only constructor!
class Asd{
private $_url;
public function __construct() {
$CI =& get_instance();
$this->_url = $CI->config->config['url'];
}
}
Below is not possible
class Asd{
private $_url='www.so.com';
public function __construct() {
$CI =& get_instance();
$this->_url = $CI->config->config['url'];
}
}
Upvotes: 1