是否可以在函数参数中默认调用类?

时间:2014-12-03 12:05:57

标签: php function class arguments

例如,我有以下功能:

public static function foo($bar = true) {

    if ($bar === true)
        $bar = Bar::getCurren()->id;

    //etc

}

是否有可能以某种方式获得这种结构?

public static function foo($bar = Bar::getCurrent()->id) {

    //etc

}

0 个答案:

没有答案
相关问题