Evaluating expressions
| From: | Eric Bouchet | Date: | Wed, 08 Nov 2000 11:36:42 +0000 |
| Subject: | Evaluating expressions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24297@lists.php.net to get a copy of this message | ||
I am looking for a way to prevent 3
1-evaluation of a string containing variable names and
2- then evaluating these variable names inside a function
1 Can easily be achieved through single quotes but I am stumbling on step 2
The idea is
myFunction(' This is a formatting string containing variables that are out
of scope like $var1');
Inside the function var1 exists and I would like to have something like:
myFunction($formatstring)
{
$var1=" I am in SCOPE";
print(eval($formatString));
}
And all that would return
This is a formatting string containing variables that are out of scope like
I am in SCOPE