hi,
i have a configuration file with this content for example:
test = "100";
teste2 = "300";
now need change the test from 100 to 300,
i just want use something like this: function ( "test" , 300 );
how can i do that?
thanks for help
change value in a configuration file
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: change value in a configuration file
Code: Select all
class Config {
protected $data = array();
public function __construct($data) {
$this->data = $data;
}
public function set($name, $value) {
$this->data[$name] = $value;
}
public function get($name) {
return isset($this->data[$name]) ? $this->data[$name] : null;
}
}
$config = new Config(array('test'=>"100", 'teste2'=>"300"));
echo $config->get('test');
$config->set('test', '300');
echo $config->get('test');
(#10850)