For instance you have: <html><bla><?php echo "abcd";?></bla></html> The simplest way to eval() it is to use: eval("?>" . $string_of_html_and_php . "<?php"); And for what you asked, try this one: eval("\$html = <<<hds $html; hds;"); It might work. HTH, Nitsan > On Sat, Feb 14, 2009 at 3:58 PM, Michael <mnm@xxxxxxxxxx> wrote: > I have a html template with php variables. I then run it through eval(). > All that works fine. Problem is that when I add simple html attributes or > javascript calls I need to use single or double quotes. And this is where > eval throws an error. So I then used htmlspecialchars to mask all the > non-php code and then decode after eval. Then I remembered the heredoc > syntax which allows both single and double quotes. So I wrote this line: > > eval("\$html=<<<hds\n\r$html;\n\rhds;"); > > But eval keeps giving me a parse error: > > Parse error: syntax error, unexpected $end in index.php(33) : > eval()'d code on line 13 > > I have tried using \r\n instead which returns error at line 11. > If I wrap the variable in {} as it should results in line 11 also. > If I insert a space after the 'hds' I get a T_SL error. > I have tried to make a wrapper heredoc variable for $html but that didn't > have any effect. > > I am running out of ideas... > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >