Jordi Scharp wrote:
No what I meant is that I have a .txt file...
On the first line of that textfile there is, for instance, a line
questions=20
I want php to somehow set a variable to that x after the
= part.. So if I change 20 to 25 in the textfile and run the
phpfile, the variable $value will be set to that 25 which is
set in the textfile..
Hope someone can help me...
-Jordi\
I had to do something similar for a random quote/tagline file...
You're parsing a number out of text... the cheeze generic way to do this would be have the number on it's own line, and then...
$fn="yourfile.txt
if (!file_exists (".\$fn")) {
echo ("PHP4.FileNotFound.$fn");
} else {
$fcontents = file ('.\$fn');
$lines= $fcontents[0];
settype($lines, "integer");
}
Take a file. Make sure it's there. If it isn't; notify, if it is, get line 0, (first line) dump the number into a varible, and make the varible a "number".
Not too bad for 2:33am, eh?
Michael