finding variables and expanding them
| From: | darcy w. christ | Date: | Thu, 26 Oct 2000 20:08:12 +0000 |
| Subject: | finding variables and expanding them | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22199@lists.php.net to get a copy of this message | ||
i have a case where i am reading a file which might have variables in it
(eg. $name). i don't necessarily know the name of the variables, i just
know that if there is one which begins with a $, i want to be able to
expand it. Now, is there a way to expand this and still keep the
contents of that file in a variable. i've been playing around with
ereg_replace, but i can't seem to use an eval or ${}.
$buffer = ereg_replace("\\$[^[:space:]]*","eval('\\1')",$buffer);
$buffer = ereg_replace("\\$[^[:space:]]*","${'\\1'}",$buffer);
does anyone know of a way to do this? i appreciate the help.
--
~darcy w. christ
Elegant Communications Inc.
416.362.9772 x222 | 416.362.8324 fax