reading from a file and parsing variables??
| From: | Derick Dorner | Date: | Wed, 29 Aug 2001 08:53:18 +0000 |
| Subject: | reading from a file and parsing variables?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-64962@lists.php.net to get a copy of this message | ||
I have a simple problem, but for some reason I can't figure it out!
I need to read in a string from a short text file, so I do that the normal way:
/*
// get string from the text file.
$filename = "textfilehere.text";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
*/
however, this text file contains variables, for example, the first could be:
Hello $variable_here
now when i print out the text file (it really needs to be emailed, but anyway) the variables are not
parsed with the variables from the script, so instead of printing the contents of $variable_here
within that string, it actually prints "$variable_here".
so, how can i parse a text file read into a string for variables??
any help is appreciated, and thank you very much in advance!
-derick