Fw: [PHP] Implement PHP within a string
| From: | Kevin Stone | Date: | Thu, 25 Jul 2002 19:04:04 +0000 |
| Subject: | Fw: [PHP] Implement PHP within a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109578@lists.php.net to get a copy of this message | ||
Sure. You want the eval() function. Can be a little tricky but you'll get
it.
http://www.php.net/manual/en/function.eval.php
-Kevin
----- Original Message -----
From: "Joshua E Minnie" <josh@acsurf.net>
To: <php-general@lists.php.net>
Sent: Thursday, July 25, 2002 12:54 PM
Subject: [PHP] Implement PHP within a string
> Is it possible to run PHP that is embedded within a string? I have a file
> that is read into a string and returned to the browser, how can I run that
> PHP?
>
> i.e.
>
> <?
> function something() {
> // this is set earlier by other functions
> // $str = "<html><body>some html code<?
> $this->getForm("guest"); ?>some
more
> html code</body></html>";
>
> return ($str);
> }
>
> echo $obj->something();
>
>
> --
> Joshua E Minnie/CIO
> josh@acsurf.net
> Phone: 616.276.9690
> Fax: 616.342.8750
> Nextel: 616.862.2847
>
> "Don't work for recognition, but always do work worthy of recognition."
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>