亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

variadic function

The so-called variable function refers to calling a function through the value of a variable. Because the value of a variable is variable, different functions can be called by changing the value of a variable. It is often used in callback functions, function lists, or to call different functions based on dynamic parameters. The method of calling a variable function is to add parentheses to the variable name.

function name() {
    echo 'jobs';
}
$func = 'name';
$func(); //調(diào)用可變函數(shù)

Variable functions can also be used in object method calls.

class book {
    function getName() {
        return 'bookname';
    }
}
$func = 'getName';
$book = new book();
$book->$func();


Continuing Learning
||
<?php function func() { echo 'my function called.'; } $name = 'func'; //調(diào)用可變函數(shù) ?>
submitReset Code