PHP methods for creating functions from strings, PHP string functions
The example in this article describes how PHP creates functions from a string. Share to everyone for your reference. Specific as follows:
PHP can put the entire function definition into a string dynamic definition, with create_function This function, you can dynamically create a function based on user input, very convenient, create_function use the method as shown in the example:
Copy the Code code as follows: <?php
$lambda =create_function (' $a, $b ', ' Return ' (strlen ($a)-strlen ($b));
$array = Array (' Really long string here,boy ', ' this ', ' middling length ', ' larger ');
Usort ($array, $LAMBDA);
Print_r ($array);
?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/968271.html www.bkjia.com true http://www.bkjia.com/PHPjc/968271.html techarticle PHP methods for creating functions from strings, PHP String Functions This article describes how PHP creates a function from a string. Share to everyone for your reference. The following: PHP can put ...