PHP:'return;'return是什么变量类型?
PHP: What variable type does 'return;' return?
以下面的代码为例:
<?php
function testing(){
echo 'testing';
return;
}
?>
根据上面的代码,'return;'语句return是什么类型的data/variable?
Based on the code above, what type of data/variable does the 'return;' statement return?
null
.
Note: If no parameter is supplied [...] NULL will be returned.
它returns null
。看到这个 Demo
<?php
function test() {
return;
}
var_dump(test()); // NULL
您的代码将 return NULL
return 引用的函数可能 return 一个 NULL 值。这与通过引用传递的函数参数不能作为 NULL(或者实际上不是变量的任何东西)传递的事实不一致。
即
<?php
function &testRet()
{
return NULL;
}
if (testRet() === NULL)
{
echo "NULL";
}
?>
解析良好并回显 NULL
以下面的代码为例:
<?php
function testing(){
echo 'testing';
return;
}
?>
根据上面的代码,'return;'语句return是什么类型的data/variable?
Based on the code above, what type of data/variable does the 'return;' statement return?
null
.
Note: If no parameter is supplied [...] NULL will be returned.
它returns null
。看到这个 Demo
<?php
function test() {
return;
}
var_dump(test()); // NULL
您的代码将 return NULL
return 引用的函数可能 return 一个 NULL 值。这与通过引用传递的函数参数不能作为 NULL(或者实际上不是变量的任何东西)传递的事实不一致。
即
<?php
function &testRet()
{
return NULL;
}
if (testRet() === NULL)
{
echo "NULL";
}
?>
解析良好并回显 NULL