faqts : Computers : Programming : Languages : PHP : Common Problems : Files

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

Is there any way to take the value of a variable name writen in a flat text file?

Nov 12th, 2002 20:33
Juan Carlos Gonzalez, G K,


You can try this code:

$fp       = fopen("var_name.txt","r");
$var_name = fgets($fp);

echo $$var_name;


/// end

If you have a file "var_name.txt" with the "foobar" writed in, then 
the echo $$var_name will be parsed (in real time) as $foobar

I hope that this helps you out with your problem