Home > Backend Development > PHP Tutorial > php动态函数调用方法_PHP

php动态函数调用方法_PHP

WBOY
Release: 2016-05-30 08:47:41
Original
809 people have browsed it

php中可以把函数名通过字符串的方式传递给一个变量,然后通过此变量动态调用函数

下面是一个简单的动态函数调用范例

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

以上所述就是本文的全部内容了,希望大家能够喜欢。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template