In this paper, we explain how PHP implements dynamic code execution. Share to everyone for your reference, as follows:
Here is the PHP dynamic execution, that is, to enter the code directly on the page, click Execute, return to the results of execution
The method is simple, mainly used:
function to implement.
The code is as follows:
<?php$code = ' return ' no code! ";"; if (isset ($_post[' Code ')) && $_post[' code ']! = ") { $code = $_post[' code '];} $newfunc = Create_function (", $code); $res = $newfunc ();? >
Xxx <?php Echo $res?>
More readers interested in PHP related content can view this site topic: "PHP Operations Office Document Tips summary (including word,excel,access,ppt)", "PHP date and Time usage summary", "PHP Object-oriented Programming tutorial", "PHP string (string) Usage summary, "Getting Started with Php+mysql database operation" and "PHP common database Operation Skills Summary"
I hope this article is helpful to you in PHP programming.
The above describes the PHP implementation of dynamic code implementation methods, including the aspects of the content, I hope that the PHP tutorial interested in a friend to help.