I find myself in the situation where I need to call a PHP function stored as a string from another PHP function.
<?php $phpcodestring = "<?php echo 'Hello World!' ?>"; echo $phpcodestring; ?>
How can I get Hello World to render to screen with the above structure?
Back up a few steps - why do you need to do that?
99.9% of the time there is a better way than
Or you could use
create_function() which internally uses something like
eval() so isn't much better, especially when you are not defining the function body directly with a string literal so you can be sure there and then there is nothing potentially dangerous.