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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
> [EMAIL PROTECTED]
> 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
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to