assign values to variables, all taken from txt file
| From: | Alain | Date: | Tue, 15 May 2001 09:05:35 +0000 |
| Subject: | assign values to variables, all taken from txt file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-52819@lists.php.net to get a copy of this message | ||
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-