首頁  >  文章  >  後端開發  >  当我运行下面的脚本,它会输出错误信息,我该怎么_PHP教程

当我运行下面的脚本,它会输出错误信息,我该怎么_PHP教程

WBOY
WBOY原創
2016-07-13 10:53:22662瀏覽

function myfunc($argument) {
echo $argument + 10;
}
$variable = 10;
echo "myfunc($variable) = " . myfunc($variable);
到底是什么原因呢?
要将自定义函数的结果传回,你需要使用return来将结果传回,而不是echo函数。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632413.htmlTechArticlefunction myfunc($argument) { echo $argument + 10; } $variable = 10; echo "myfunc($variable) = " . myfunc($variable); 到底是什么原因呢? 要将自定义函数的结果传回,...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn