Home >Backend Development >PHP Tutorial >PHP dynamic function calling method, PHP dynamic calling_PHP tutorial

PHP dynamic function calling method, PHP dynamic calling_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:53:07962browse

php dynamic function calling method, php dynamic calling

In php, you can pass the function name to a variable through a string, and then dynamically call the function through this variable

The following is a simple dynamic function call example

<html>
<head>
<title>Dynamic Function Calls</title>
</head>
<body>
<&#63;php
function sayHello()
{
  echo "Hello<br />";
}
$function_holder = "sayHello";
$function_holder();
&#63;>
</body>
</html>

The above is the entire content of this article, I hope you all like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1003995.htmlTechArticlephp dynamic function calling method, php dynamically calling php can pass the function name to a variable through a string , and then dynamically call the function through this variable. Here is a simple...
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