This article gives an example of how PHP implements dynamic code execution. Share to everyone for your reference, specific as follows:
The dynamic execution of PHP described here, that is, directly enter the code on the page, click Execute, return execution results
The method is simple, mainly using:
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 ();
? >
<! DOCTYPE html>
For more information on PHP-related content readers can view the site topics: "PHP operation Office Document tips summary (including word,excel,access,ppt)", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course", "PHP string (string) Summary of usage, Getting Started tutorial on Php+mysql database operations, and summary of common PHP database operations techniques
I hope this article will help you with the PHP program design.