📌  相关文章
📜  PHP | ReflectionParameter isPassedByReference()函数

📅  最后修改于: 2022-05-13 01:56:30.927000             🧑  作者: Mango

PHP | ReflectionParameter isPassedByReference()函数

ReflectionParameter::isPassedByReference()函数是PHP中的一个内置函数,如果指定的参数通过引用传递,则用于返回 TRUE,否则返回 FALSE。

句法:

bool ReflectionParameter::isPassedByReference ( void )

参数:此函数不接受任何参数。

返回值:如果指定的参数通过引用传递,此函数返回TRUE,否则返回FALSE。

下面的程序说明了PHP中的ReflectionParameter::isPassedByReference()函数
方案一:

isPassedByReference();
    
// Getting TRUE if the specified parameter 
// is passed by reference, otherwise FALSE.
var_dump($B);
?>

输出:

bool(true)

方案二:

isPassedByReference());
var_dump($B->isPassedByReference());
var_dump($C->isPassedByReference());
?>

输出:

bool(false)
bool(false)
bool(true)

参考: https://www. PHP.net/manual/en/reflectionparameter.ispassedbyreference。 PHP