change value in a configuration file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jason7899
    New Member
    • Mar 2008
    • 59

    change value in a configuration file

    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
  • YarrOfDoom
    Recognized Expert Top Contributor
    • Aug 2007
    • 1243

    #2
    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:
    [code=PHP]
    values["test1"] = 100;
    values["test2"] = 300;

    setValue("test1 ",300);
    [/code]
    Where the setValue()-function would be this:
    [code=PHP]
    function setValue($targe t,$value) {
    //perform value validation and processing, if needed, here
    $values[$target] = $value;
    }
    [/code]

    Comment

    Working...