Re: Execute statements from a string???
| From: | Shawn McKenzie | Date: | Tue, 22 Oct 2002 06:19:28 +0000 |
| Subject: | Re: Execute statements from a string??? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120860@lists.php.net to get a copy of this message | ||
Very cool! Thanks!
"Jome" <jome@emoj.net> wrote in message
news:20021022050344.98163.qmail@pb1.pair.com...
> > 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
>
>