php中echo和return之间的区别? [英] Difference between echo and return in php?

查看:66
本文介绍了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"

这篇关于php中echo和return之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆