View Full Version : eval() if the string isn't 100% PHP code?

18 Jul 2005, 05:37 PM

Okay, say I have a string that could have either ' or " quotes in it when it is inserted into the database.

Then, when retrieved, it is parsed so that it replaces "#BLOG-TITLE-HERE#" (when it was inserted) with a PHP statement that outputs the $title variable. (It does numerous replacements but this is my example.)

Now, the question:

How can I make the script execute the PHP inside the string, even though the string isn't 100% PHP code? How can I get it to execute ONLY the PHP and not try to execute the whole string? Thanks for any help.