您的位置:首页 > 编程语言 > PHP开发

PHP 执行与变量值相同的方法

2016-07-04 13:59 579 查看
mixed call_user_func ( callback $function [, mixed $parameter [, mixed $...]] )

mixed call_user_func_array ( callback $function, array $param_arr )

<?php
function barber($type)
{
echo "You wanted a $type haircut, no problem";
}
call_user_func('barber', "mushroom");
call_user_func('barber', "shave");
?>

-----------------或者你可以这样

<?php

function fuck()
{
echo 'fuck';
}

$a = 'fuck';
$a();
--------------------------全面的写法

<?php

class test extends testBase{

function name()
{
echo 'name namenamenamename11111111 ';
}

function pass()
{
echo 'passpasspasspasspasspass22222222222 ';
}

}

class testBase{

function __construct()
{
$test_func=$_GET['st'];
$this->$test_func();
}
}

new test();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: