By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

change value in a configuration file

P: 59
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
Feb 13 '12 #1
Share this Question
Share on Google+
1 Reply


YarrOfDoom
Expert 100+
P: 1,247
You can't do that as far as I know.
The most straightforward approach to getting something similar would be using an array with string indices, for example:
Expand|Select|Wrap|Line Numbers
  1. values["test1"] = 100;
  2. values["test2"] = 300;
  3.  
  4. setValue("test1",300);
  5.  
Where the setValue()-function would be this:
Expand|Select|Wrap|Line Numbers
  1. function setValue($target,$value) {
  2. //perform value validation and processing, if needed, here
  3. $values[$target] = $value;
  4. }
  5.  
Feb 16 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.