Re: assign values to variables, all taken from txt file
| From: | Tobias Talltorp | Date: | Tue, 15 May 2001 10:29:55 +0000 |
| Subject: | Re: assign values to variables, all taken from txt file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52829@lists.php.net to get a copy of this message | ||
From what I could see you want variable variables
$value = $line[0];
$variable = $line[1];
$$variable = $value;
// Tobias
""Alain"" <alainygr@evitech.fi> wrote in message
news:9dqrh1$23a$1@toye.p.sourceforge.net...
> Hello,
> I am trying to get values assigned to variables, by taking these data from
a
> textfile.
> my txt file looks like that:
> variable1 // value1
> variable2 // value2
> etc...
> The point here is that I want to be able to get BOTH the variable name and
> its corresponding value..
> I tried things like:
> ----------//-----------
> $configuration_data = file("conf/configuration.txt");
> for($index=0; $index < count($configuration_data); $index++)
> {
> $line = explode("//",$configuration_data[$index]);
> $value = "$line[0]";
> $variable = "$line[1]";
> $"\$variable" = "$value";
> }
> ----------//------------
> So it's that "$"\$variable" = "$value";" which is wrong and
> now I don't
have
> any inspiration anymore...
>
> Could somebody help me pleeeease?!
> thanks,
> -Alain-
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>