在函数参数列表PHP中取消定义变量集作为默认值

时间:2015-08-17 12:46:36

标签: php

编辑:我希望函数的参数的默认值为undefined,这样当没有参数传递给函数时,isset($ argument)的返回值等于TRUE

我不确定我是否知道正确的命名法,但我需要做的就是在课堂上这样做:

public function something ( $myvariable = unset ($myvariable) ){
    if ( isSet ( $myvariable ) ) //do something
    else //do something else
}

我知道如果我将其设置为$myvariable = NULL,我可以检查null,但是如果可能的话,我希望在网站上保持编码风格不变。

我该怎么做?

0 个答案:

没有答案