与回声与返回连接时,句点和逗号之间的区别?

我刚刚发现这行得通:

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.

相关文章