Re: String containing PHP Code
| From: | Lars Torben Wilson | Date: | Mon, 16 Jun 2003 23:56:40 +0000 |
| Subject: | Re: String containing PHP Code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151758@lists.php.net to get a copy of this message | ||
On Mon, 2003-06-16 at 16:45, Suhas Pharkute wrote:
> Hello,
>
> I have a php script which generates a string which has php code in it. I need to run that
> code.
>
> For example:
>
> <?php
>
> $str = " <?php echo 'Hello World!'; ?>";
> ?>
>
>
> Is there any way that we can do it? I know I can do it by writing it to file but then it is no
> more secured.
>
> Please let me know,
>
> Thanks
> Suhas
You want eval(). It should all be explained here:
http://www.php.net/eval
Hope this helps,
Torben
--
Torben Wilson <torben@php.net> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----