当我运行下面的脚本,它会输出错误信息,我该怎么_PHP教程
程序员文章站
2022-05-29 11:59:01
...
function myfunc($argument) {
echo $argument + 10;
}
$variable = 10;
echo "myfunc($variable) = " . myfunc($variable);
到底是什么原因呢?
要将自定义函数的结果传回,你需要使用return来将结果传回,而不是echo函数。
echo $argument + 10;
}
$variable = 10;
echo "myfunc($variable) = " . myfunc($variable);
到底是什么原因呢?
要将自定义函数的结果传回,你需要使用return来将结果传回,而不是echo函数。
上一篇: ~图片下传时发生的异常