ereg_replace and eval()
| From: | darcy w. christ | Date: | Thu, 26 Oct 2000 14:12:09 +0000 |
| Subject: | ereg_replace and eval() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22138@lists.php.net to get a copy of this message | ||
Hi,
does anyone know a way to find and replace any words that begin with $
and eval() them so that they are expanded? i'm reading in a file that
may have variables in it, which i need to evaluate and i'm having
trouble working with ereg_replace. i know how to do this in perl, but
i'm not sure how to do this with the POSIX ereg_replace.
i've started with this, but i',m not sure how to include the eval:
ereg_replace("(\$[^ ])","\\1",$buffer);
Placing an eval around "\\1" does seem to work. i get an error of:
Warning: Unexpected character in input: '\' (ASCII=92) state=1
in Eval
code on line 1
i appreciate any suggestions.
--
~darcy w. christ
Elegant Communications Inc.
416.362.9772 x222 | 416.362.8324 fax