Re: getting an variable value from an array entry
| From: | Ian Truelsen | Date: | Sun, 30 Nov 2003 21:39:54 +0000 |
| Subject: | Re: getting an variable value from an array entry | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171421@lists.php.net to get a copy of this message | ||
On Mon, 1 Dec 2003 00:16:07 +0300
zhuravlev alexander <zaa@ulstu.ru> wrote:
> Use eval. http://www.php.net/eval
>
> % cat temp.txt
> Temperature $temp degree.
> % cat temp.php
> <?php
>
> $temp = '5';
>
> $filename = "./temp.txt";
> $handle = fopen ($filename, "r");
> $code = fread ($handle, filesize ($filename));
> fclose ($handle);
> print $code."<br>";
> eval("\$result = \"".addslashes($code)."\";");
> echo $result;
> ?>
>
Thanks a lot. That is exactly what I hoped I could do.
--
Ian Truelsen
Email: ian@ihtruelsen.dyndns.org
AIM: ihtruelsen
Homepage: http://www.ihtruelsen.dyndns.org
Signature key (742B740D) available at pgp.mit.edu
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]