Home > Article > Backend Development > PHP variable function analysis
Use of variable functions (principle of equal substitution): In PHP, if the "function name" is assigned to a string type variable, but when using the variable, if it has parentheses, the PHP engine will Analytic Functions.
Note: Variable functions cannot be used for echo, print, unset(), isset(), empty(), include, require and similar language structures. They need to be encapsulated and implemented by yourself
Example:
$funcName='md5'; echo $funcName('king');//md5() echo '<br/>'; get_defined_functions( ) 得到所有已定义的函数,返回是数组,包括系统函数和用户自定义函数
Related recommendations:
What are the uses of PHP variable functions, detailed examples
php variable functions Use analysis
Classic usage of parsing PHP variable functions_PHP tutorial
The above is the detailed content of PHP variable function analysis. For more information, please follow other related articles on the PHP Chinese website!