php中echo和return之间的区别?
问题描述:
这让我感到困惑,函数中的echo和return之间有什么区别
This so confusing me ,What is the difference between the echo and return, in functions
答
echo
将内容输出到控制台或Web浏览器.
echo
outputs content to the console or the web browser.
示例:
echo "Hey, this is now showing up on your screen!";
return
在函数或方法的末尾返回一个值.
return
returns a value at the end of a function or method.
示例:
function my_function()
{
return "Always returns this";
}
echo my_function(); // displays "Always returns this"