与 echo 与 return 连接时句号和逗号之间的区别? [英] Difference between period and comma when concatenating with echo versus return?

查看:20
本文介绍了与 echo 与 return 连接时句号和逗号之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现这会起作用:

I just found that this will work:

echo $value , " continue";

但这不会:

return $value , " continue";

虽然."两者都适用.

这里的句号和逗号有什么区别?

What is the difference between a period and a comma here?

推荐答案

return 只允许一个表达式.但是 echo 允许一个表达式列表,其中每个表达式用逗号分隔.但请注意,由于 echo 不是函数而是一种特殊的语言结构,将表达式列表括在括号中是非法的.

return does only allow one single expression. But echo allows a list of expressions where each expression is separated by a comma. But note that since echo is not a function but a special language construct, wrapping the expression list in parenthesis is illegal.

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

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