create_function() - php 选项信息函数
create_function()
(PHP 4 >= 4.0.1, PHP 5, PHP 7)
Create an anonymous (lambda-style) function
说明
create_function(string $args,string $code): stringCreates an anonymous function from the parameters passed, and returns a unique name for it.
CautionThis function internally performs aneval()and as such has the same security issues aseval(). Additionally it has bad performance and memory usage characteristics.
If you are using PHP 5.3.0 or newer a nativeanonymous functionshould be used instead.
参数
Usually these parameters will be passed as single quote delimited strings. The reason for using single quoted strings, is to protect the variable names from parsing, otherwise, if you use double quotes there will be a need to escape the variable names, e.g.$avar.$args
The function arguments.
$codeThe function code.
返回值
Returns a unique function name as a string,orFALSE
on error.
范例
Creating an anonymous function withcreate_function()
You can use this function, to (for example) create a function from information gathered at run time: