I've got PHP and HTML code stored in a database table. When I get this data, I need to echo the HTML and process the PHP. I thought I could use eval()
for this, which works, if I do this eval("echo 'dlsj'; ?> EVALED ");
I get "dlsjEVALED" printed out.
The problem is, I get a fatal error when I run longer scripts. Things like:
Parse error: syntax error, unexpected '<' in /home/content.php(18) : eval()'d code on line 1
Foo
';` instead of just `Foo
`). No, actually I suggest you don't use `eval` at all. But it's just me. – zneak Mar 26 '10 at 00:11