Home  >  Article  >  Backend Development  >  Detailed explanation of php variable function examples

Detailed explanation of php variable function examples

小云云
小云云Original
2018-02-26 11:57:131515browse

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 Analytical function, I hope it can help everyone.

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() Gets all defined functions and returns an array, including system functions and user-defined functions

Related recommendations:

Introduction to variable functions in php

php defines the usage of variable function with the number of parameters

php variable function usage analysis

The above is the detailed content of Detailed explanation of php variable function examples. 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