I have variables stored in a text file. They work like varibale name (with out a $) = than the value. I need to read these variables into my php script as the names that they are stored as in the text file with the value that comes after the equal sign. Could somebody give me a quick snipet of code for this problem? Thanks.
Here is an example of the file:
author_name = Robin Liss title = Test Article keywords = keywords, here summary = summary here content = content here notes = notes here
I think that this should do it! <? $file = file($filename); foreach($file as $line) { $pos = strpos($line,"="); $var = trim(substr($line,0,$pos)); $val = trim(substr($line,$pos+1)); ${var} = $val; } ?>
that last line should be ${$var} = $val;