I'm a believer in "If eval() is the answer, you're probably asking the wrong question."
(Attributed to the creator of PHP.)
Why do you want/need PHP code in the database in the first place? A better understanding of that might lead us to a better solution.
In general, I'd rather store any/all code in PHP files, perhaps as function definitions that can be require()'d. Then if for some reason you need to use info from the database to control what code gets executed, you would, for example, just store a function name or parameter or whatever in the DB, and use that to control what code gets executed or how it gets executed.