Reputation: 1030
You have a string, which contains a snippet of PHP code:
$run_me = "echo ('Hello World!!');";
How can you get PHP to run the code, contained in $run_me?
You can't do:
include ($run_me);
That would include the path $run_me, so what's the solution?
Upvotes: 0
Views: 61
Reputation: 1108
One way is to use eval()
. This will execute the string you enter as PHP code.
Upvotes: 3