I'm trying to figure out how to stored php values in a string/file. I have a text file with "var1=foo&var2=foo2" etc in it, is there a way to read the values?
2 Answers
You could use file_get_contents() to open the file and parse_url() to parse the contents into an associative array.
$file = file_get_contents('file.txt');
parse_str($file, $params);