Write your code to a temporary file, include the file and then delete it.

<?php
// HTML + PHP mixed code
$code = "<b><?php echo 'BOO!' ?></b>";

// Create a temporary file to store the code
$file = tempnam ('/tmp', 'eval');
error_log ($code, 3, $file);

// include the temp file
include ($file);

// erase the temp file
unlink ($file);
?>

/* Note - I have not tested the above code, however it should work... :) */

Good luck!

--zak


----- Original Message -----
From: "James Atkinson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 20, 2001 10:08 PM
Subject: RE: [PHP] Parse PHP inside a variable


> I'm in the same boat, I've tried eval() but it dosan't like mixing PHP and
> HTML code...
>
> I've tried the suggestions listed in the php.net manual too to no avail...
>
> - James
>
>
> > -----Original Message-----
> > From: Lenar Lõhmus [mailto:[EMAIL PROTECTED]]
> > Sent: June 20, 2001 3:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Parse PHP inside a variable
> >
> >
> > maybe function eval()?
> >
> > lenar.
> > "Claus Heiko Niesen" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hello
> > >
> > > I'm having a variable that contains HTML with embedded PHP code.  When
I
> > > echo it then the PHP code does not get executed.  Is there a way I can
> > > parse/print the content of my variable?
> > >
> > > Thanks
> > >    Claus
> > >
> > >
> > > --
> > > 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]
>
>
> --
> 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