Heredoc inside eval?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux