Re: Execute statements from a string???

From: Date: Tue, 22 Oct 2002 14:46:07 +0000
Subject: Re: Execute statements from a string???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120919@lists.php.net to get a copy of this message
Thanks for the answers! Next question. How can I structure the string and how do I echo the HTML and the variable contents? I want the following output to the browser: <td>Hello...</td> $somevar = "Hello..."; $string = "<td><?php echo $somevar ?></td>\n"; or $string = "<td>$somevar</td>\n"; eval() ??? Thanks! Shawn "Shawn McKenzie" <nospam@mckenzies.net> wrote in message news:20021022043404.89596.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??? > > TIA > -Shawn > >

« previous php.general (#120919) next »