Home >Backend Development >PHP Tutorial >PHP variable function analysis

PHP variable function analysis

小云云
小云云Original
2018-02-28 09:26:481352browse

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 &#39;<br/>&#39;;
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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn