奇怪的问题。
我有这段代码:
function createNumber()
{
// other code initialisizing $base and $arr
$result = checkArray($base, $arr);
echo $result; // <- this doesn't print nothing
} // function
function checkArray($value,$array)
{
$result = '';
if (in_array($value,$array))
{
$value = $value+1;
checkArray($value,$array);
}
else
{
$result = $value;
//return $result;
//echo $result; <- this doesn't print nothing
}
echo $result; // <- this print the right value
//return $result; // <- this seems doesn't return nothing
}
如果在checkArray
我取消注释return $result row
并发表评论echo $result
,则会正确打印$ result。
否则,似乎不返回任何内容(即createNumber函数不会打印任何内容。
有可能吗?