变量函数
?
如果一個變量名后有圓括號,php 將尋找與變量的值同名的函數,并且將嘗試執行它。
?
<?php
function foo() {
????echo "In foo()<br />\n";
}
function bar($arg = '') {
????echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string)
{
????echo $string;
}
$func = 'foo';
$func();????????// This calls foo()
$func = 'bar';
$func('test');??// This calls bar()
$func = 'echoit';
$func('test');??// This calls echoit()
?>
轉載于:https://www.cnblogs.com/John-/p/6961735.html
總結
- 上一篇: 1023. 组个最小数
- 下一篇: Struts2学习第七课 ActionS