php calling function dynamically code example
Example 1: php dynamic function call
public function view_all($building_post_id, $member_id = array());
$this->view_all($building_post_id);
$this->view_all($building_post_id, 12);
Example 2: php call dynamic function
$vFn = "Login";
$vFn();
call_user_func($vFn, $vars);
abstract class mBase {
public function main() {
.....
}
}
class mA extends mBase {
public function main() {
parent->main();
.....
}
}
class mB extends mBase {
public function main() {
parent->main();
.....
}
}
function runMM(mBase $module) {
$module->main();
}
$m = 'mB';
runMM ($m);