Hmm... that may work for what you're trying to do and it may
not... if your string contains something like this:

$str = <<<END_STRING
<b>This is some HTML</b><br>
<i>Powered by PHP <?php echo phpversion() ?></i>
END_STRING;

You're going to have a bit of a problem processing that with
eval.

I'm not completely sure on this one, but you might try this:

eval('?>' . $str);

Assuming your string looks like the $str above, the
beginning '?>' should drop eval out of PHP mode, print the
HTML, execute the PHP commands when it goes back into PHP
mode, etc... it should all work that way.

--Toby

----- Original Message -----
From: "Alexander Skwar" <[EMAIL PROTECTED]>
To: "Matt" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, January 24, 2001 5:02 PM
Subject: Re: [PHP] Processing PHP within a string variable


> So sprach Matt am Wed, Jan 24, 2001 at 03:56:37PM -0600:
> > string is a mixture of PHP code and HTML. I want to be
able to output the
> > string with the PHP code inside the string processed.
Right now the PHP
>
> http://www.php.net/manual/en/function.eval.php
>
> Alexander Skwar
> --
> How to quote: http://learn.to/quote (german)
http://quote.6x.to (english)
> Homepage: http://www.digitalprojects.com   |
http://www.iso-top.de
>    iso-top.de - Die guenstige Art an Linux Distributionen
zu kommen
> Uptime: 4 hours 59 minutes
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
> To contact the list administrators, e-mail:
[EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to