Re: Execute statements from a string???
| From: | Jome | Date: | Tue, 22 Oct 2002 05:03:40 +0000 |
| Subject: | Re: Execute statements from a string??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120856@lists.php.net to get a copy of this message | ||
> How can I execute a php statement/series of statements that are stored in
a
> string???
>
> Example:
>
> $string = "if($a == $b) { echo 'a = b'; }";
>
> Now I want to execute the statement if($a == $b) { echo 'a = b'; }
>
> How can I do that with the string???
http://www.php.net/manual/en/function.eval.php
eval($string);
Jome