1

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 2

4

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);

CodePad.

Sign up to request clarification or add additional context in comments.

Comments

0

Or if you can change it, theres always serialize() and unserialize()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.